COPY with a variable path

From: Bill Todd <pg(at)dbginc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: COPY with a variable path
Date: 2008-11-27 20:52:40
Message-ID: 492F0898.6080508@dbginc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I want to execute the following COPY command in a stored procedure,
however, I need to pass the path to the file as an input parameter.
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?

copy contact.palm_import from 'c:/_junk/palm.csv'
with delimiter as ','
null as ''
csv quote as '"';

Thanks,

Bill

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2008-11-27 21:07:04 Re: COPY with a variable path
Previous Message Grzegorz Jaśkiewicz 2008-11-27 19:25:20 convert a query to use window functions