Skip site navigation (1) Skip section navigation (2)

Re: hstore parser incorrectly handles malformed input

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ryan Kelly <rpkelly22(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: hstore parser incorrectly handles malformed input
Date: 2012-04-26 19:50:33
Message-ID: (view raw or whole thread)
Lists: pgsql-bugs
Ryan Kelly <rpkelly22(at)gmail(dot)com> writes:
> 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.

Hm, I would have expected all three of these to result in "a" having
an empty-string value.  I see nothing in the hstore documentation
suggesting that I must write a=>"" or some such to get an empty value,
and it also says "whitespace between pairs or around the => sign is
ignored".  So what is your reasoning for calling this malformed input?

(We're in agreement that the current behavior is wrong, though.)

			regards, tom lane

In response to


pgsql-bugs by date

Next:From: rikard.pavelicDate: 2012-04-26 22:20:51
Subject: BUG #6618: incorrect restore for composite columns when order changes
Previous:From: Ryan KellyDate: 2012-04-26 19:05:13
Subject: hstore parser incorrectly handles malformed input

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group