Skip to site navigation (Press enter)

Re: [GENERAL] variable in COPY TO variable

Albe Laurenz Wed, 17 Oct 2007 00:17:13 -0700

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
  • Previous message
  • View by thread
  • View by date
  • Next message
  • [GENERAL] variable in COPY <table> TO variable Rob Shepherd
    • Re: [GENERAL] variable in COPY <table> TO variable Albe Laurenz
      • Re: [GENERAL] variable in COPY <table> TO vari... Rob Shepherd

Reply via email to

The Mail Archive
  • The Mail Archive home
  • pgsql-general - all messages
  • pgsql-general - about the list
  • Expand
  • Previous message
  • Next message
  • The Mail Archive home
  • Add your mailing list
  • FAQ
  • Support
  • Privacy
  • D960CB61B694CF459DCFB4B0128514C25DD06D@exadv11.host.magwien.gv.at