From: | Brendan Jurd <direvus(at)gmail(dot)com> |
---|---|
To: | Greg Stark <stark(at)mit(dot)edu> |
Cc: | Josh Berkus <josh(at)agliodbs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL) |
Date: | 2013-03-25 19:40:12 |
Message-ID: | CADxJZo3TmBXMUxoNu8RSmRe73BE7=PoE7Qbc3dnUQsP2C2vBEg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 26 March 2013 05:26, Greg Stark <stark(at)mit(dot)edu> wrote:
> I'm not as sanguine as Tom is about how likely these corner cases will
> be met actually. As far as I can tell checking IS NULL on
> array_length() was the supported way to check for 0-length arrays
> previously
Correct. There was no other way to check for empty arrays, because
every empty array was zero-D, and zero-D returns NULL from all array
interrogation functions, even array_ndims (which is totally bonkers).
>
> At least if it's a clean break then everyone on 9.3 knows they need to
> do IS NULL and everyone on 9.4 knows they need to check for 0.
And, as I pointed out in at the top of the thread, you can write
"coalesce(array_length(a,1), 0) = 0" if you want to be confident your
code will continue work in either case, and for some folks I expect
that will be the least painful way to upgrade from 9.3 -> 9.4.
Cheers,
BJ
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2013-03-25 19:51:18 | Re: Let's invent a function to report lock-wait-blocking PIDs |
Previous Message | Heikki Linnakangas | 2013-03-25 19:14:57 | Re: Assertion failure when promoting node by deleting recovery.conf and restart node |