Re: Stored Procedure: Copy table from; path = text variable

From: Richard Huxton <dev(at)archonet(dot)com>
To: Charles Pare <debile_trash(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Stored Procedure: Copy table from; path = text variable
Date: 2007-07-03 19:01:03
Message-ID: 468A9CEF.20709@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-07-03 19:05:27 Re: Date for a week day of a month
Previous Message Charles Pare 2007-07-03 18:49:48 Stored Procedure: Copy table from; path = text variable