Problem with \set command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux