Search Postgresql Archives

Re: COPY FROM in psql

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

 



Matthew Vernon <matthew.vernon@xxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux