It seems that the hstore parser has some odd behavior in the the handling of certain malformed input constructions:
[db]> select 'a=>,b=>1'::hstore; hstore -------------- "a"=>",b=>1" [db]> select 'a=> ,b=>1'::hstore; hstore -------------- "a"=>",b=>1" [db]> select 'a=>, b=>1'::hstore; ERROR: Syntax error near 'b' at position 5 LINE 2: select 'a=>, b=>1'::hstore; In my mind, all of these should have been rejected as erroneous input. To that end, I have attached a patch which causes all of these inputs to be rejected as invalid. -Ryan Kelly
diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c index 0eb48cf..13d6c22 100644 --- a/contrib/hstore/hstore_io.c +++ b/contrib/hstore/hstore_io.c @@ -76,6 +76,10 @@ get_val(HSParser *state, bool ignoreeq, bool *escaped) { elog(ERROR, "Syntax error near '%c' at postion %d", *(state->ptr), (int4) (state->ptr - state->begin)); } + else if (*(state->ptr) == ',') + { + elog(ERROR, "Syntax error near '%c' at postion %d", *(state->ptr), (int4) (state->ptr - state->begin)); + } else if (*(state->ptr) == '\\') { st = GV_WAITESCIN;
-- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs