Что вы можете сделать, это написать скрипт av sql, который выводит его в файл.
Expript exp. sql:
-- don't align
\a
-- tuples only
\t
\pset fieldsep '|'
-- write to workfile.sql
\o workfile.sql
-- get the create table statement into the workfile
SELECT EXPORT_OBJECTS('','public.foo',FALSE);
-- put the COPY command for in-line data into the workfile
SELECT 'COPY public.foo FROM STDIN DELIMITER ''|'';';
-- export the table's data
SELECT * FROM public.foo;
-- append a backslash-dot line to mark the end of the input of the copy command.
SELECT '\.';
Результирующий рабочий файл. sql :
CREATE TABLE public.foo
(
id numeric(37,15),
first_name varchar(256),
last_name varchar(256),
hire_dt timestamp
);
CREATE PROJECTION public.foo
(
id,
first_name,
last_name,
hire_dt
)
AS
SELECT foo.id,
foo.first_name,
foo.last_name,
foo.hire_dt
FROM public.foo
ORDER BY foo.id,
foo.first_name,
foo.last_name,
foo.hire_dt
UNSEGMENTED ALL NODES;
COPY public.foo FROM STDIN DELIMITER '|';
1.000000000000000|Arthur|Dent|2017-02-05 00:00:00
2.000000000000000|Ford|Prefect|2017-02-05 00:00:00
3.000000000000000|Zaphod|Beeblebrox|2017-02-05 00:00:00
4.000000000000000|Tricia|McMillan|2017-02-05 00:00:00
[ . . . ]
41.000000000000000|Lunkwill|Lunkwill|2017-02-05 00:00:00
42.000000000000000|Fook|Fook|2017-02-05 00:00:00
\.