From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Cc: | Joe Conway <mail(at)joeconway(dot)com>, Postgresql General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Array constructor requires one argument |
Date: | 2007-01-09 22:49:45 |
Message-ID: | 12210.1168382985@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Martijn van Oosterhout <kleptog(at)svana(dot)org> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-01-09 22:57:10 | Re: Questions about horizontal partitioning |
Previous Message | Matthew T. O'Connor | 2007-01-09 22:49:20 | Re: Autovacuum Improvements |