Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)

From: Greg Stark <stark(at)mit(dot)edu>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brendan Jurd <direvus(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Date: 2013-03-25 18:26:45
Message-ID: CAM-w4HMzHgKhOtpa4DFVkPKqrWKip8GanPLY6kubjBYsH+JWsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 25, 2013 at 5:14 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> Tom,
>
>> No, it *isn't* a good idea. GUCs that change application-visible
>> semantics are dangerous. We should have learned this lesson by now.
>
> Really? I thought that standard_conforming_strings was a great example
> of how to ease our users into a backwards-compatibility break.

It is, but it was made in full knowledge of the risks and costs.

What do you do if you're given two modules that have opposite
expectations for this variable? One module or the other might have
hidden unexpected bugs or even security holes if the variable is set
in a way it doesn't expect. You have to pick one value for the whole
database.

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 so I suspect a lot of applications will need to be updated.
But it's not a hard update to do and is the kind of update that's
often needed on major database upgrades.

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. If
there's a GUC then people need to code defensively without knowing
which semantics they'll get. And if they test they need to test twice
under both settings just in case the user's database has the other
setting.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2013-03-25 18:33:05 Re: Interesting post-mortem on a near disaster with git
Previous Message Bruce Momjian 2013-03-25 18:10:28 Re: pg_upgrade segfaults when given an invalid PGSERVICE value