Problem with \set command - Mailing list pgsql-admin

From Ullah, Syed
Subject Problem with \set command
Date
Msg-id 583C75099BC5684298E49ECD29A0CA1801AAE4A59D25@DMSP-MSG-EVS03.mail.pvt
Whole thread Raw
List 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.

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: postgresql 8.3 logging user passwords in clear text
Next
From: "Ozer, Pam"
Date:
Subject: Re: Case Insensitive Database