From: | Alex Hunsaker <badalex(at)gmail(dot)com> |
---|---|
To: | Ryan Kelly <rpkelly22(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Vik Reykja <vikreykja(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: hstore parser incorrectly handles malformed input |
Date: | 2012-04-28 23:52:20 |
Message-ID: | CAFaPBrSBpeQNkr+r5COMrE83ukWEY5+icp-=o2Sr4cZJjr3EXg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, Apr 28, 2012 at 17:20, Ryan Kelly <rpkelly22(at)gmail(dot)com> wrote:
> I don't think any language supports the empty key edge case in this way.
> The only language I know of that will let you get away with it is Perl,
> and in that case you get undef, not the empty string, and it's a warning
> if you have warnings on:
>
> $ use warnings;
> $ my $h = { 1 => };
> Odd number of elements in anonymous hash
Well... kind of but not really, perl (as usual) is a bit funky here.
Try it with more than one key. What ends up happening is the 2nd key
is used as the first keys value... Surprise! You also don't get the
warning, it sees 1=>2,(void) or something.
$ perl -E 'my $h = {1=>,2=>}; say $h->{1};'
2
Anyway, +1 for what tom proposed.
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Frost | 2012-04-29 00:17:25 | Re: 9.1.3 backends getting stuck in 'startup' |
Previous Message | Ryan Kelly | 2012-04-28 23:20:25 | Re: hstore parser incorrectly handles malformed input |