Problem with \set command

From: "Ullah, Syed" <Syed(dot)Ullah(at)JavelinDirect(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Problem with \set command
Date: 2010-08-24 16:19:11
Message-ID: 583C75099BC5684298E49ECD29A0CA1801AAE4A59D25@DMSP-MSG-EVS03.mail.pvt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I used this following command to set a variable in psql:

\set data_dir '/source_code/lookup/data'

And then I tried to used that variable inside a \copy command like this:

\COPY mytable_lookup FROM :data_dir/mytable_lookup.txt delimiter '|'

I was expecting that ':data_dir' will be replaced by the value that was defined earlier, but got this error
message:

:data_dir/mytable_lookup.txt: Invalid argument

I have a feeling it is considering the whole 'data_dir/mytable_lookup.txt' as a variable name.

Is there anything in psql that is equivalent to shell script's ${var_name} to denote the beginning and
end of a variable name?

Thanks.

Syed

This email is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential or otherwise protected from disclosure. Dissemination, distribution or copying of this e-mail or any attachments by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is prohibited. If you are not the intended recipient of this message or the employee or agent responsible for delivery of this email to the intended recipient, please notify the sender by replying to this message and then delete it from your system. Any use, dissemination, distribution, or reproduction of this message by unintended recipients is strictly prohibited and may be unlawful.

Browse pgsql-admin by date

  From Date Subject
Next Message Alex Hunsaker 2010-08-24 16:28:56 Re: Unable to drop role
Previous Message Kevin Kempter 2010-08-24 16:08:00 Postgresql 8.3 on OSX hangs