Обсуждение: select into vs. create as

Поиск
Список
Период
Сортировка

select into vs. create as

От
Oskar Stolc
Дата:
Hi.

Is there some difference between creating a new table with

SELECT * INTO newtable FROM oldtable;

and with

CREATE newtable as SELECT * FROM oldtable

?

Are these two commands equivalent ?

Thank you.

Oskar

PS.: Sorry for may english, I am not a native english speeker

Re: select into vs. create as

От
Tom Lane
Дата:
Oskar Stolc <stolc@intrak.sk> writes:
> Are these two commands equivalent ?

Yes.

I recommend CREATE AS, though.  plpgsql thinks that SELECT INTO
means something quite different, so you'll inevitably get confused
later on if you use SELECT INTO :-(

            regards, tom lane