Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 005521F02EF3 for ; Thu, 26 Apr 2012 16:50:51 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SNUiF-0006h0-LB for pgsql-bugs@postgresql.org; Thu, 26 Apr 2012 19:50:49 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q3QJoX2D012885; Thu, 26 Apr 2012 15:50:33 -0400 (EDT) To: Ryan Kelly cc: pgsql-bugs@postgresql.org Subject: Re: hstore parser incorrectly handles malformed input In-reply-to: <20120426190513.GB31886@llserver.lakeliving.com> References: <20120426190513.GB31886@llserver.lakeliving.com> Comments: In-reply-to Ryan Kelly message dated "Thu, 26 Apr 2012 15:05:13 -0400" Date: Thu, 26 Apr 2012 15:50:33 -0400 Message-ID: <12884.1335469833@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/159 X-Sequence-Number: 32910 Ryan Kelly 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