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: "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 21:47:34
Message-ID: 24773.1206049654@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:
> As discussed on -hackers, this patch allows the construction of an
> empty array if an explicit cast to an array type is given (as in,
> ARRAY[]::int[]).

Applied with minor fixes; mostly, ensuring that the cast action would
propagate down to sub-arrays, as in

regression=# select array[[1],[2.2]]::int[];
array
-----------
{{1},{2}}
(1 row)

I was interested to realize that this fix validates the decision to
pass down the type information on-the-fly during transformExpr recursion.
It would have been a lot more painful to do it if we'd taken the A_Const
approach.

I didn't do anything about removing A_Const's typename field, but I'm
thinking that would be a good cleanup patch.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Colin Wetherbee 2008-03-20 22:45:59 Re: [postgis-users] how many min. floating-points?
Previous Message Magnus Hagander 2008-03-20 21:36:06 Re: nntp not workiNG

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-03-20 22:08:02 Re: Sort Refinement
Previous Message Sam Mason 2008-03-20 21:34:00 Re: Sort Refinement

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-20 23:26:50 Re: [PATCHES] Show INHERIT in \du
Previous Message Tom Lane 2008-03-20 18:03:11 Re: [PATCHES] [GENERAL] Empty arrays with ARRAY[]