Re: hstore parser incorrectly handles malformed input

Поиск
Список
Период
Сортировка
От Alex Hunsaker
Тема Re: hstore parser incorrectly handles malformed input
Дата
Msg-id CAFaPBrSBpeQNkr+r5COMrE83ukWEY5+icp-=o2Sr4cZJjr3EXg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: hstore parser incorrectly handles malformed input  (Ryan Kelly <rpkelly22@gmail.com>)
Список pgsql-bugs
On Sat, Apr 28, 2012 at 17:20, Ryan Kelly <rpkelly22@gmail.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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Ryan Kelly
Дата:
Сообщение: Re: hstore parser incorrectly handles malformed input
Следующее
От: Jeff Frost
Дата:
Сообщение: Re: 9.1.3 backends getting stuck in 'startup'