Re: SELECT INTO and ON COMMIT

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: SELECT INTO and ON COMMIT
Дата
Msg-id CAKFQuwZX_+4A-2iKGo3t-ZPm13GHHCKA5GCqESW0=K1OboyOuA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: SELECT INTO and ON COMMIT  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: SELECT INTO and ON COMMIT
Список pgsql-general
On Wed, May 13, 2015 at 4:38 PM, Bruce Momjian <bruce@momjian.us> wrote:
On Wed, May 13, 2015 at 05:29:36PM -0600, Yves Dorfsman wrote:
>
> Is there any way to add an ON COMMIT clause to a SELECT INTO TEMP TABLE?

Well CREATE TABLE has a ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }
clause, but I don't see it in SELECT INTO, so it seems you have to
create the temp table using CREATE TABLE, then INSERT ... SELECT.


​From the documentation of SELECT INTO

"​
The PostgreSQL usage of SELECT INTO to represent table creation is historical. It is best to use CREATE TABLE AS for this purpose in new code.
​"​


​Which effectively means consider the feature deprecated.  Especially since CREATE TABLE is standard conforming and SELECT INTO is not.

Given this I'm not sure why we bothered to add "UNLOGGED" to SELECT INTO back in 9.1 ...

David J.


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: SELECT INTO and ON COMMIT
Следующее
От: Yves Dorfsman
Дата:
Сообщение: Re: SELECT INTO and ON COMMIT