run COPY as user other than postgres - Mailing list pgsql-general

From Kirk Wythers
Subject run COPY as user other than postgres
Date
Msg-id A58A7CEC-6F60-4ADB-AC88-655DCBC10123@gmail.com
Whole thread Raw
Responses Re: run COPY as user other than postgres
Re: run COPY as user other than postgres
List pgsql-general
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
anextra step or two) to have the postgres user own the files that I am creating with COPY TO. Here is a simple example
wherethe location '/some/path/to/file/file.csv' is owned by another user and it would be very spiffy if I could run the
COPYTO as that user. Any ideas?  



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;

pgsql-general by date:

Previous
From: François Beausoleil
Date:
Subject: Re: pg_stop_backup running for 2h10m?
Next
From: Ryan Kelly
Date:
Subject: Re: run COPY as user other than postgres