Search Postgresql Archives

psql variable quoting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm having quoting issues... or concatenation or just issues when trying to use psql variables.

TRUNCATE TABLE :tbl;
COPY :tbl FROM xxxxx WITH CSV HEADER;

For xxxxx I want to do a concatenation of :import_path :tbl '.csv'
Obviously I can't have the spaces in it. If I remove the spaces, it doesn't expand the variables.

I can set a import_file variable like so:
\set import_file '/tmp/:tbl.csv'
That expands properly but isn't quoted when used in the COPY command.

How do I do this?

Artacus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux