Re: Suggestion to reduce COPY command output to csv file

From: Bo Victor Thomsen <bo(dot)victor(dot)thomsen(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Suggestion to reduce COPY command output to csv file
Date: 2020-03-05 07:22:08
Message-ID: 334c89b7-8643-2642-4fe9-8f8ca4905526@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

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)

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2020-03-05 14:43:49 shm
Previous Message David G. Johnston 2020-03-04 21:40:48 Re: Suggestion to reduce COPY command output to csv file

Browse pgsql-general by date

  From Date Subject
Next Message Daulat Ram 2020-03-05 07:45:35 Real application clustering in postgres.
Previous Message Justin 2020-03-05 01:37:03 Re: Performance Problem