From: | Sergey Konoplev <gray(dot)ru(at)gmail(dot)com> |
---|---|
To: | Kirk Wythers <wythe001(at)umn(dot)edu> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: run COPY as user other than postgres |
Date: | 2013-04-24 03:23:32 |
Message-ID: | CAL_0b1vLPa_T_xOn6mY3rW2z7wAPZsMPMt+HL0NZYX-9Ya8U+Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Apr 23, 2013 at 1:11 PM, Kirk Wythers <wythe001(at)umn(dot)edu> wrote:
> I would like to run the COPY command as a user other than "postgres". I find it a bit of a pain (or at least requiring an extra step or two) to have the postgres user own the files that I am creating with COPY TO. Here is a simple example where the location '/some/path/to/file/file.csv' is owned by another user and it would be very spiffy if I could run the COPY TO as that user. Any ideas?
sudo chown anotheruser:postgres /some/path/to/file/file.csv
sudo chmod 664 /some/path/to/file/file.csv
This will set the file's group to postgres and allow it's members to
write to the file.
>
>
>
> COPY (
> SELECT * FROM
> some_table
> WHERE
> 2012 = EXTRACT (YEAR FROM some_column) --AND value IS NOT NULL
> )
> TO '/some/path/to/file/file.csv' WITH CSV HEADER;
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
--
Kind regards,
Sergey Konoplev
Database and Software Consultant
Profile: http://www.linkedin.com/in/grayhemp
Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979
Skype: gray-hemp
Jabber: gray(dot)ru(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Konstantin Izmailov | 2013-04-24 04:07:33 | Re: inserting into "date" field returns error (COPY/BINARY) |
Previous Message | Sergey Konoplev | 2013-04-24 03:08:05 | Re: Log messages regarding automatic vacuum and exclusive locks |