Re: Stored Procedure: Copy table from; path = text variable - Mailing list pgsql-general

From Richard Huxton
Subject Re: Stored Procedure: Copy table from; path = text variable
Date
Msg-id 468A9CEF.20709@archonet.com
Whole thread Raw
In response to Stored Procedure: Copy table from; path = text variable  (Charles Pare <debile_trash@hotmail.com>)
List pgsql-general
Charles Pare wrote:
> Hi, in a stored procedure, if I do COPY table FROM 'mypath'
> DELIMITERS '\t'; it works but if my path is a text variable which
> contain my path, i.e.COPY table FROM mytextvar DELIMITERS '\t'; it
> doesn't work, I get ERROR: syntax error at or near "$1"SQL state:
> 42601Context: SQL statement in PL/PgSQL function "parseinsert" near
> line 15Is there any workaround? I want to create a temporary table,
> copy from and parse the table, all with dynamic path depending of how
> the function is called.Thank'sCharles

Try building your COPY as text and use EXECUTE.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Charles Pare
Date:
Subject: Stored Procedure: Copy table from; path = text variable
Next
From: "A. Kretschmer"
Date:
Subject: Re: Date for a week day of a month