Exsamples for COPY

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: inc(at)piksel(dot)ee
Subject: Exsamples for COPY
Date: 2020-02-01 07:44:24
Message-ID: 158054306426.19850.827178569802884479@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/sql-copy.html
Description:

It would be benefitial to add some more complex (real-life) exsamples to new
syntax

Eg:
Reading TAB-delimited UTF8 CSV file residing in local machine and Postrge is
installed into local machice (windows):
copy City (city_name, city_code) from 'C:\Temp\city_data.csv' (FORMAT csv,
HEADER true, DELIMITER E'\t', QUOTE '"', ENCODING 'UTF-8');

Writing semicolon-delimited CSV UTF-8 file to server temporary folder
forcing zip code numbers to quote:
copy (select id, street_name, zip_code from delivery_point) to
'/tmp/bi/place.csv' (format csv, header true, delimiter ';', quote '"',
FORCE_QUOTE (zip_code), encoding 'UTF-8');

Cheers

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2020-02-01 08:33:38 pg_dump, --exclude-table-data
Previous Message Daniel Gochin 2020-01-30 12:55:30 Re: pg_dump documentation page