Search Postgresql Archives

Re: variable in COPY <table> TO variable

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

 



Rob Shepherd wrote:
> I'm following the synatx
> 
> COPY <tablename> TO 'filename'
> 
> .....but i'm trying to use a variable as the filename.
> 
[...]
> 
> returns the error....
> 
> ERROR: syntax error at or near "$1" at character 21
> QUERY: COPY tt_archive TO $1
> CONTEXT:  SQL statement in PL/PgSQL function "archive" near line 16

A case for dynamic SQL!
http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html#PLPGSQ
L-STATEMENTS-EXECUTING-DYN

Yours,
Laurenz Albe

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


[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