Try PostgreSQL 19 COPY FROM Multi-line HEADER from a Desktop GUI
PostgreSQL 19 lets COPY FROM skip multiple header lines with HEADER n. Run server-side COPY ... FROM with a COPY HEADER integer in HiDataLinker's SQL editor, then inspect the loaded rows — without a workbench CSV import wizard.
正文目前为英文。
On 24 November 2026, Hubert “depesz” Lubaczewski wrote about a practical PostgreSQL 19 change that is easy to miss: COPY FROM can now skip more than one leading line. The PostgreSQL 19 release notes record the same improvement, and the piece also appeared on Planet PostgreSQL. This guide shows how to try COPY ... FROM ... WITH (FORMAT csv, HEADER n) from HiDataLinker, a free MIT PostgreSQL desktop GUI (MySQL in the same client): local-first credentials, URL paste, Dump / same-engine migrate, and no seat, connection, or tab freemium wall.
The new COPY HEADER integer syntax requires a PostgreSQL 19+ server. Confirm with SELECT version();.
What HiDataLinker actually ships
HiDataLinker v1.3.0 includes a SQL editor and a result grid. Paste a postgresql:// URL or DATABASE_URL, keep the profile on your machine, and run the documented COPY FROM statement yourself. After the load, SELECT the table and inspect rows in the grid. If file_fdw exists on the server, you can also run CREATE FOREIGN TABLE in the same editor; v1.3.0 lists extensions in the object tree once they exist.
It does not ship a workbench CSV import or export wizard — omitted in v1.0.0 and not added since. It does not implement psql \copy from a laptop file, and it does not drive the COPY FROM STDIN client protocol. The path in COPY ... FROM 'filename' is read by the PostgreSQL server, as the official COPY docs describe. HiDataLinker will not pick a laptop CSV for you.
For COPY TO ... FORMAT json (export; json is not valid on COPY FROM), see Try PostgreSQL 19 SQL from a Desktop GUI. This page covers only COPY FROM multi-line HEADER.
1. Connect to a PostgreSQL 19 server
- Install from hidatalinker.onesolo.app.
- Open New Connection — paste the URI or fill host, port, user, password, and database. See paste a DATABASE_URL.
- Test, then connect. Profiles stay on your machine — local-first, no hosted workspace.
- In the SQL editor, run
SELECT version();and confirm you are on PostgreSQL 19 or newer.
Place the input file where the server can read it (the PostgreSQL OS user must have access; the path is from the server's point of view). A report CSV often starts with a title, a generated-at line, and only then the column names — HEADER true skips just the first line, which is not enough.
2. Skip multiple header lines with HEADER n
Official COPY documentation: on input, HEADER true discards the first line; a non-negative integer discards that many lines. Create a table that matches the data columns, then load:
CREATE TABLE inventory (
sku text,
warehouse text,
qty integer,
unit_cost numeric
);
COPY inventory
FROM '/var/lib/postgresql/import/inventory.csv'
WITH (FORMAT csv, HEADER 3);
SELECT * FROM inventory;
HEADER 3 skips the title, the metadata line, and the column-name row, then loads the data rows. Per the official docs, HEADER 1 matches HEADER true; HEADER 0 matches HEADER false. Adjust the integer to your file, and point FROM at a path that exists on the server — the example path is illustrative only.
Run the statements in the SQL editor (⌘/Ctrl+Enter). The result grid shows the SELECT output so you can confirm the rows landed in the right columns.
3. Optional: the same HEADER option on file_fdw
PostgreSQL 19 also gives file_fdw the same header option. Foreign-table options need an explicit value (header '3', not a bare flag). Changing file-level options requires a superuser or a role with pg_read_server_files. If the extension is installed, run this in the SQL editor; HiDataLinker has no file_fdw wizard.
CREATE EXTENSION IF NOT EXISTS file_fdw;
CREATE SERVER inv_files FOREIGN DATA WRAPPER file_fdw;
CREATE FOREIGN TABLE inventory_csv (
sku text,
warehouse text,
qty integer,
unit_cost numeric
) SERVER inv_files
OPTIONS (
filename '/var/lib/postgresql/import/inventory.csv',
format 'csv',
header '3'
);
SELECT * FROM inventory_csv;
Official limits (and a quiet failure mode)
- Multi-line
HEADERis for COPY FROM only. Official docs: integers other than 0 or 1 are not allowed onCOPY TO. depesz shows the server errorcannot use multi-line header in COPY TO. HEADERis not allowed withbinaryorjsonformat.- If
nis larger than the number of lines in the file, depesz notes thatCOPYloads zero rows and does not error — so alwaysSELECTafterward. COPYwith a filename is a server-side read, not a desktop file picker.
HiDataLinker is a thin Tauri desktop app for PostgreSQL and MySQL — paste DATABASE_URL, keep creds local, and avoid seat / connection / tab freemium walls. Honest v1: MySQL + PostgreSQL as marketed; not a CSV workbench. Overview: /db-client.
Soft next step
Need a desktop GUI that can run PostgreSQL 19 COPY ... FROM ... WITH (FORMAT csv, HEADER n) in a SQL editor and show the loaded rows, without a freemium wall?
- Download: https://hidatalinker.onesolo.app/
- Source: https://github.com/henrybit/HiDataLinker