For some reason the code below breaks in psql as supplied with Greenplum at the \copy stage:
\set tmp1 public.tmp1
DROP TABLE IF EXISTS :tmp1;
CREATE TABLE :tmp1 (new_id varchar(255), old_id BIGINT) DISTRIBUTED BY (old_id);
\echo :tmp1
\copy :tmp1 FROM 'file1.csv' WITH DELIMITER '|' HEADER CSV;
ERROR: syntax error at or near ":"
LINE 1: COPY :tmp1 FROM STDIN WITH DELIMITER '|' HEADER CSV;
How can you use a variable table name with the copy command in psql?