Problem with \set command

Поиск
Список
Период
Сортировка
От Ullah, Syed
Тема Problem with \set command
Дата
Msg-id 583C75099BC5684298E49ECD29A0CA1801AAE4A59D25@DMSP-MSG-EVS03.mail.pvt
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: postgresql 8.3 logging user passwords in clear text
Следующее
От: "Ozer, Pam"
Дата:
Сообщение: Re: Case Insensitive Database