Re: COPY FROM WHEN condition

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: COPY FROM WHEN condition
Date: 2018-10-11 08:59:25
Message-ID: 20181011085925.5zopu7jvxzs5c4xq@squirrel.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

## Surafel Temesgen (surafel3000(at)gmail(dot)com):

> Currently we can not moves data from a file to a table based on some
> condition on a certain column

You can:
COPY ( query ) TO 'filename';

There's even an example in the documentation:
https://www.postgresql.org/docs/10/static/sql-copy.html
"To copy into a file just the countries whose names start with 'A':
COPY (SELECT * FROM country WHERE country_name LIKE 'A%') TO '/usr1/proj/bray/sql/a_list_countries.copy';"

Regards,
Christoph

--
Spare Space.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Surafel Temesgen 2018-10-11 09:03:00 Re: COPY FROM WHEN condition
Previous Message Surafel Temesgen 2018-10-11 08:54:55 COPY FROM WHEN condition