Re: [PATCHES] [GENERAL] Empty arrays with ARRAY[] - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] [GENERAL] Empty arrays with ARRAY[]
Date
Msg-id 13159.1206036191@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Empty arrays with ARRAY[]  ("Brendan Jurd" <direvus@gmail.com>)
List pgsql-hackers
"Brendan Jurd" <direvus@gmail.com> writes:
> A quick recap: I submitted a patch for empty ARRAY[] syntax back in
> November, and as far as I can see it never made it to the patches
> list.  Gregory suggested a different way of approaching the problem
> (quoted below), but nobody commented further about how it might be
> made to work.

> I'd like to RFC again on Gregory's idea, and if that doesn't bear any
> fruit I'd like to submit the patch as-is for review.

Greg's idea is basically to invent array-of-UNKNOWN as a genuine
datatype, which as I stated way back when seems fairly dangerous
to me.  UNKNOWN is already a pretty slippery animal, and I don't
know what cast paths we might open up by doing that.  I think
the require-a-cast solution is a lot less likely to result in
unforeseen side-effects.

>> Whereas my patch requires you to write
>> a text[]: =array[]::text[];
>> ... which seems pretty stupid.

In practice you'd write

    DECLARE
      a text[] := '{}';

which is even shorter, so I don't find this convincing.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Proposal: new large object API
Next
From: Decibel!
Date:
Subject: Re: Maximum statistics target