From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ryan Kelly <rpkelly22@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: hstore parser incorrectly handles malformed input
Date: Thu, 26 Apr 2012 15:50:33 -0400
Message-ID: <12884.1335469833@sss.pgh.pa.us> (raw)
In-Reply-To: <20120426190513.GB31886@llserver.lakeliving.com>
References: <20120426190513.GB31886@llserver.lakeliving.com>
Ryan Kelly <rpkelly22@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, rpkelly22@gmail.com
Subject: Re: hstore parser incorrectly handles malformed input
In-Reply-To: <12884.1335469833@sss.pgh.pa.us>
References: <20120426190513.GB31886@llserver.lakeliving.com> <12884.1335469833@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox