Vassilis Papadimos wrote:
> Thomas J Keller wrote:
>> Excellent.
>> So the first step is to create an empty table:
>>
>> passwords=# CREATE TABLE foo_bar LIKE original_table;
>> ERROR: syntax error at or near "LIKE" at character 22
>> LINE 1: CREATE TABLE foo_bar LIKE original_table;
>
> SQL doesn't have this "do what I mean" feature yet :-)
Ahem... Apparently SQL *does* have this "do what I mean" feature (or at
least PostgreSQL does!) I've never heard of it before.
But you have to write it like this:
CREATE TABLE foo_bar (like original_table);
(Including the parentheses.)
I still like the
SELECT DISTINCT * FROM original_table INTO foo_bar;
solution though, two birds with one stone...
Vassilis.