pgsql: arrays: tighten checks for multi-dimensional input

Started by Bruce Momjianover 12 years ago3 messagescomitters
Jump to latest
#1Bruce Momjian
bruce@momjian.us

arrays: tighten checks for multi-dimensional input

Previously an input array string that started with a single-element
array dimension would then later accept a multi-dimensional segment.

BACKWARD INCOMPATIBILITY

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d0ee93797d9c06e619b3f382705d99ee195bb573

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c | 8 ++++----
src/test/regress/expected/arrays.out | 2 +-
src/test/regress/sql/arrays.sql | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Jeff Davis
pgsql@j-davis.com
In reply to: Bruce Momjian (#1)
Re: pgsql: arrays: tighten checks for multi-dimensional input

On Sat, 2014-02-01 at 15:49 +0000, Bruce Momjian wrote:

arrays: tighten checks for multi-dimensional input

Previously an input array string that started with a single-element
array dimension would then later accept a multi-dimensional segment.

BACKWARD INCOMPATIBILITY

-select cardinality('{{{1}},{{2,3},{3,4}}}'::int[]);
+select cardinality('{{{1,9},{5,6}},{{2,3},{3,4}}}'::int[]);
  cardinality 
 -------------
            8

I was a little confused by this change: the query changed, but the
results did not. Was that a bugfix, or were the original semantics
intentional?

I didn't immediately find the thread where this was discussed, so if you
send a link that might answer my question.

Regards,
Jeff Davis

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Bruce Momjian
bruce@momjian.us
In reply to: Jeff Davis (#2)
Re: pgsql: arrays: tighten checks for multi-dimensional input

On Tue, Feb 4, 2014 at 11:21:24AM -0800, Jeff Davis wrote:

On Sat, 2014-02-01 at 15:49 +0000, Bruce Momjian wrote:

arrays: tighten checks for multi-dimensional input

Previously an input array string that started with a single-element
array dimension would then later accept a multi-dimensional segment.

BACKWARD INCOMPATIBILITY

-select cardinality('{{{1}},{{2,3},{3,4}}}'::int[]);
+select cardinality('{{{1,9},{5,6}},{{2,3},{3,4}}}'::int[]);
cardinality 
-------------
8

I was a little confused by this change: the query changed, but the
results did not. Was that a bugfix, or were the original semantics
intentional?

Yes. the problem was that the new checking would throw an error for that
misformed array.

I didn't immediately find the thread where this was discussed, so if you
send a link that might answer my question.

Here is the spot in the thread where I replied:

/messages/by-id/20140201011125.GG19957@momjian.us

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers