mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
[pubsub/query] quote values using single quotes
This fixes the problem with base-16 encoded values which may start with digits: 015AB.... In such cases, the parser recognizes them as numbers but fails to parse because of the follow-up characters (AB). ``` failed to parse tm.events.type=Tx AND hash=136E18F7E4C348B780CF873A0BF43922E5BAFA63: parse error near digit (line 1 symbol 31 - line 1 symbol 32): "6" ``` So, from now on we should quote any values. This seems to be the way Postgresql has chosen.
This commit is contained in:
+20
-13
@@ -13,30 +13,37 @@ func TestParser(t *testing.T) {
|
||||
query string
|
||||
valid bool
|
||||
}{
|
||||
{"tm.events.type=NewBlock", true},
|
||||
{"tm.events.type = NewBlock", true},
|
||||
{"tm.events.type=TIME", true},
|
||||
{"tm.events.type=DATE", true},
|
||||
{"tm.events.type='NewBlock'", true},
|
||||
{"tm.events.type = 'NewBlock'", true},
|
||||
{"tm.events.name = ''", true},
|
||||
{"tm.events.type='TIME'", true},
|
||||
{"tm.events.type='DATE'", true},
|
||||
{"tm.events.type='='", true},
|
||||
{"tm.events.type='TIME", false},
|
||||
{"tm.events.type=TIME'", false},
|
||||
{"tm.events.type==", false},
|
||||
{"tm.events.type=NewBlock", false},
|
||||
{">==", false},
|
||||
{"tm.events.type NewBlock =", false},
|
||||
{"tm.events.type>NewBlock", false},
|
||||
{"tm.events.type 'NewBlock' =", false},
|
||||
{"tm.events.type>'NewBlock'", false},
|
||||
{"", false},
|
||||
{"=", false},
|
||||
{"=NewBlock", false},
|
||||
{"='NewBlock'", false},
|
||||
{"tm.events.type=", false},
|
||||
|
||||
{"tm.events.typeNewBlock", false},
|
||||
{"tm.events.type'NewBlock'", false},
|
||||
{"'NewBlock'", false},
|
||||
{"NewBlock", false},
|
||||
{"", false},
|
||||
|
||||
{"tm.events.type=NewBlock AND abci.account.name=Igor", true},
|
||||
{"tm.events.type=NewBlock AND", false},
|
||||
{"tm.events.type=NewBlock AN", false},
|
||||
{"tm.events.type=NewBlock AN tm.events.type=NewBlockHeader", false},
|
||||
{"AND tm.events.type=NewBlock ", false},
|
||||
{"tm.events.type='NewBlock' AND abci.account.name='Igor'", true},
|
||||
{"tm.events.type='NewBlock' AND", false},
|
||||
{"tm.events.type='NewBlock' AN", false},
|
||||
{"tm.events.type='NewBlock' AN tm.events.type='NewBlockHeader'", false},
|
||||
{"AND tm.events.type='NewBlock' ", false},
|
||||
|
||||
{"abci.account.name CONTAINS Igor", true},
|
||||
{"abci.account.name CONTAINS 'Igor'", true},
|
||||
|
||||
{"tx.date > DATE 2013-05-03", true},
|
||||
{"tx.date < DATE 2013-05-03", true},
|
||||
|
||||
Reference in New Issue
Block a user