Proposed fix for Bug #15259 (invalid empty array returned by intarray "&" operator)

Lists: pgsql-hackers
From: Alexey Kryuchkov <alexey(dot)kruchkov(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Proposed fix for Bug #15259 (invalid empty array returned by intarray "&" operator)
Date: 2018-07-02 17:09:27
Message-ID: CAN85JcYphDLYt4CpMDLZjjNVqGDrFJ5eS3YF=wLAhFoDQuBsyg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

The attached patch fixes Bug #15259 [1] in the intarray module, making the
'&' array intersection operator return proper zero-dimensional empty arrays
instead of one-dimensional, zero-length "empty" arrays.

In [2] this problem was addressed by changing the behaviour of
construct_[md_]array(), but the intarray module does not use these
functions. The patch I propose contains the relevant fixes to the
intarray module, along with regression tests.

[1]:
https://www.postgresql.org/message-id/153053285112.13258.434620894305716755%40wrigleys.postgresql.org
[2]: https://www.postgresql.org/message-id/[email protected]

Best regards,

Alexey Kryuchkov

Attachment Content-Type Size
intarray-correct-empty-array-dimensions-15259.patch text/x-patch 1.8 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexey Kryuchkov <alexey(dot)kruchkov(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposed fix for Bug #15259 (invalid empty array returned by intarray "&" operator)
Date: 2018-07-09 18:28:55
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Alexey Kryuchkov <alexey(dot)kruchkov(at)gmail(dot)com> writes:
> The attached patch fixes Bug #15259 [1] in the intarray module, making the
> '&' array intersection operator return proper zero-dimensional empty arrays
> instead of one-dimensional, zero-length "empty" arrays.

LGTM, pushed. Thanks for the report and patch!

regards, tom lane