Skip site navigation (1) Skip section navigation (2)

Re: COPY with a variable path

From: Bill Todd <pg(at)dbginc(dot)com>
To: rod(at)iol(dot)ie
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY with a variable path
Date: 2008-11-27 23:09:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Raymond O'Donnell wrote:
> On 27/11/2008 20:52, Bill Todd wrote:
>> Substituting the input parameter for the literal path does not work and
>> neither does using PREPARE/EXECUTE. How can I pass the file path as a
>> parameter?
> You could write a pl/pgsql function which constructs the query as a
> string and then runs it with EXECUTE.
> Ray.
> ------------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod(at)iol(dot)ie
> Galway Cathedral Recitals:
> ------------------------------------------------------------------
According to the PostgreSQL help file EXECUTE is used to execute a 
prepared statement. I tried that but when I call PREPARE with COPY as 
the statement I get an error. Are you saying that I can also use EXECUTE as

EXECUTE AStringVariable;

where AStringVariable contains a valid SQL statement? If so, that is the 


In response to

pgsql-general by date

Next:From: Chris BrowneDate: 2008-11-27 23:10:37
Subject: Re: Using postgres.log file for replication
Previous:From: Tom LaneDate: 2008-11-27 21:49:23
Subject: Re: Nested Loop Left Join always shows rows=1

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group