Re: Insert/select union bug

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Insert/select union bug
Дата
Msg-id 20060927102649.GB13693@svana.org
обсуждение исходный текст
Ответ на Re: Insert/select union bug  (Peter <peter@greatnowhere.com>)
Ответы Re: Insert/select union bug  (Peter <peter@greatnowhere.com>)
Список pgsql-general
On Wed, Sep 27, 2006 at 01:05:56PM +0300, Peter wrote:
> Typecast eliminates the issue, you're right on that as well. However, my
> problem is that those statements are dynamically generated on various
> tables/columns, so typecasting would mean extracting target field type
> and translating fieldtype code into SQL typename. Rather messy.

In general, pushing down of types from the insert is a bit tricky, the
planner tries to unify the UNION first and needs a type for the values.
It guesses "text" if it doesn't know.

Using COPY avoids this issue ofcourse, because there's a direct link to
the table. Similarly, as of 8.2 it will be possible to do:

INSERT INTO table (blah) VALUES (x,y,a),(f,d,g),(s,f,g), etc...

Which will also avoid the issue.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: Jon Lapham
Дата:
Сообщение: Re: Restart after power outage: createdb
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: postgresql ddl scripts - drop object fails entire script