Re: COPY FROM in psql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: COPY FROM in psql
Дата
Msg-id 11307.1353438301@sss.pgh.pa.us
обсуждение исходный текст
Ответ на COPY FROM in psql  (Matthew Vernon <matthew.vernon@sac.ac.uk>)
Список pgsql-general
Matthew Vernon <matthew.vernon@sac.ac.uk> writes:
> naiively, you might try:
> \set pwd '\'' `pwd` '\''
> COPY table FROM :pwd || '/relative/path/to/data' ;

Umm ... why don't you just use a relative path as-is, with \copy
instead of COPY?

    \copy table from 'relative/path/to/data'

The server-side COPY is likely to give you a lot of permission
headaches, ie the server's userid will need to be able to read that
file and the directories above it.

If you really need to do this I'd suggest doing the path-stitching
in the \set:

    \set target '\'' `pwd` '/relative/path/to/data\''
    COPY table FROM :target ;

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: COPY FROM in psql
Следующее
От: Thomas
Дата:
Сообщение: Re: Experiences with pl/Java