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

Re: off-by-one mistake in array code error reporting

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Alexey Klyukin <alexk(at)commandprompt(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: off-by-one mistake in array code error reporting
Date: 2011-02-01 06:00:23
Message-ID: AANLkTikedWX0ps_ujCBJmfkzoKm1J-UCBKrUpnHwhDAe@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, Jan 31, 2011 at 17:19, Alexey Klyukin <alexk(at)commandprompt(dot)com> wrote:
> While working on PL/Perl patch for arrays as input arguments I've noticed that
> PostgreSQL reports one less dimension in the 'number of array dimensions (%d)
> exceeds the maximum allowed (%d)", i.e.
>
> select '{{{{{{{1,2},{3,4}},{{5,6},{7,8}}},{{{9,10},{11,12}},{{13,14},{15,16}}}},                                                                     {{{{17,18},{19,20}},{{21,22},{23,24}}},{{{25,26},{27,28}},{{29,30},{31,32}}}}}, {{{{{1,2},{3,4}},{{5,6},{7,8}}},{{{9,10},{11,12}},{{13,14},{15,16}}}},          {{{{17,18},{19,20}},{{21,22},{23,24}}},{{{25,26},{27,28}},{{29,30},{31,32}}}}}},                                                                                {{{{{{1,2},{3,4}},{{5,6},{7,8}}},{{{9,10},{11,12}},{{13,14},{15,16}}}},         {{{{17,18},{19,20}},{{21,22},{23,24}}},{{{25,26},{27,28}},{{29,30},{31,32}}}}}, {{{{{1,2},{3,4}},{{5,6},{7,8}}},{{{9,10},{11,12}},{{13,14},{15,16}}}},          {{{{17,18},{19,20}},{{21,22},{23,24}}},{{{25,26},{27,28}},{{29,30},{31,32}}}}}}}'                                                                               ::int[];
>
> ERROR:  number of array dimensions (6) exceeds the maximum allowed (6)
>
> Attached is the simple fix for that.

Thanks. I found one more same bug in PL/pgSQL.

s=# DO $$ DECLARE a int[]; BEGIN a = (ARRAY[1])[1][1][1][1][1][1][1]; END; $$;
ERROR:  number of array dimensions (6) exceeds the maximum allowed (6)

-- 
Itagaki Takahiro

In response to

pgsql-hackers by date

Next:From: Magnus HaganderDate: 2011-02-01 06:35:25
Subject: Re: Error code for "terminating connection due to conflict with recovery"
Previous:From: Itagaki TakahiroDate: 2011-02-01 05:36:32
Subject: Re: setlocale and gettext in Postgres

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