off-by-one mistake in array code error reporting

Alexey Klyukin <alexk@commandprompt.com>

From: Alexey Klyukin <alexk@commandprompt.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-01-31T08:19:25Z
Lists: pgsql-hackers

Attachments

Hi,

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.

/A

--
Alexey Klyukin
The PostgreSQL Company - Command Prompt, Inc.