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 24773.1206049654@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Empty arrays with ARRAY[]  ("Brendan Jurd" <direvus@gmail.com>)
Responses Re: [PATCHES] [GENERAL] Empty arrays with ARRAY[]
List pgsql-hackers
"Brendan Jurd" <direvus@gmail.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

pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Unique Constraints using Non-Unique Indexes
Next
From: Tom Lane
Date:
Subject: Re: Sort Refinement