Re: Array constructor requires one argument

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Array constructor requires one argument
Дата
Msg-id 12210.1168382985@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Array constructor requires one argument  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Martijn van Oosterhout <kleptog@svana.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Questions about horizontal partitioning
Следующее
От: "Matthew T. O'Connor"
Дата:
Сообщение: Re: Autovacuum Improvements