Re: [PATCHES] [GENERAL] Empty arrays with ARRAY[]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Brendan Jurd" <direvus(at)gmail(dot)com>
Cc: "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] [GENERAL] Empty arrays with ARRAY[]
Date: 2008-03-20 18:03:11
Message-ID: 13159.1206036191@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

"Brendan Jurd" <direvus(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Colin Wetherbee 2008-03-20 18:16:50 Re: [postgis-users] how many min. floating-points?
Previous Message John Smith 2008-03-20 18:02:12 [postgis-users] how many min. floating-points?

Browse pgsql-hackers by date

  From Date Subject
Next Message Dawid Kuroczko 2008-03-20 18:51:56 Re: Lazy constraints / defaults
Previous Message Simon Riggs 2008-03-20 18:01:56 Re: Unique Constraints using Non-Unique Indexes

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-20 21:47:34 Re: [PATCHES] [GENERAL] Empty arrays with ARRAY[]
Previous Message Tom Lane 2008-03-20 17:37:32 Re: pg_dump --no-tablespaces patch