From: Bo Victor Thomsen <bo.victor.thomsen@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Suggestion to reduce COPY command output to csv file
Date: Thu, 5 Mar 2020 08:22:08 +0100
Message-ID: <334c89b7-8643-2642-4fe9-8f8ca4905526@gmail.com> (raw)
In-Reply-To: <CAJ=omAhsJ89HqBtLBhE33RjvQ6ykbZjtM18igf=T-42m-nveBQ@mail.gmail.com>
References: <CAJ=omAhsJ89HqBtLBhE33RjvQ6ykbZjtM18igf=T-42m-nveBQ@mail.gmail.com>
You can use this alternative:
/\copy (SELECT col1, col2, col3... from cities) TO
'/var/lib/pgsql/cities.csv' (DELIMITER ',', FORMAT 'csv', HEADER)/
The list /col1, col2, col3.../ should only contain names on*necessary*
columns and not under any circumstances the geometry column
--
Med venlig hilsen / Kind regards
Bo Victor Thomsen
Den 04-03-2020 kl. 19:38 skrev postggen2020 s:
> \copy cities TO '/var/lib/pgsql/cities.csv' (DELIMITER ',', FORMAT
> 'csv', HEADER)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: bo.victor.thomsen@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: Suggestion to reduce COPY command output to csv file
In-Reply-To: <334c89b7-8643-2642-4fe9-8f8ca4905526@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox