Search Postgresql Archives

Re: Array constructor requires one argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martijn van Oosterhout <kleptog@xxxxxxxxx> writes:
> On Tue, Jan 09, 2007 at 04:09:21PM -0500, Tom Lane wrote:
>> One possibility that might handle Martijn's problem is to allow the
>> construct
>> ARRAY[]::type[]

> I don't think it would be too hard to fix, I'll look tomorrow.

It could be pretty ugly, because type assignment normally proceeds
bottom-up :-(.  What you might have to do is make the raw grammar
representation of ARRAY[] work like A_Const does, ie, there's a
slot to plug in a typecast.  That's pretty much vestigial now for
A_Const, if memory serves, but it'd be needful if ARRAY[] has to
be able to "see" the typecast that would otherwise be above it in
the parse tree.

Come to think of it, there is an additional possible benefit to doing
it this way, which is that if ARRAY[] knows a target array type then
it can just coerce all the elements to that without bothering with
trying to induce a common type.  So you should be able to save a few
cycles in the non-empty case, too.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux