2 ms·
That COPY trick is really neat. I've always used SELECT INTO. SELECT * INTO TEMP copy FROM foobar; \copy "copy" to 'foobar.csv' with csv heade
by luhn 5y ago
That COPY trick is really neat. I've always used SELECT INTO.
SELECT *
INTO TEMP copy
FROM foobar;
\copy "copy" to 'foobar.csv' with csv headers
- haki 5y agoI'm always looking for new copy tricks. Is "copy" a temporary table? Or a variable...?
- luhn 5y agoTemporary table. Although looking at the docs it seems CREATE TABLE AS is the recommended syntax. https://www.postgresql.org/docs/13/sql-createtableas.html https://www.postgresql.org/docs/13/sql-createtableas.html CREATE TEMP TABLE "copy" AS SELECT * FROM foobar;