
Skipping Bad Rows During a PostgreSQL CSV Import Safely
PostgreSQL 17 can skip rows with bad values during COPY. See ON_ERROR, REJECT_LIMIT and verbose logging in action, and the errors they do not cover.
Tag
590 posts

PostgreSQL 17 can skip rows with bad values during COPY. See ON_ERROR, REJECT_LIMIT and verbose logging in action, and the errors they do not cover.

Turn a nested XML file into a flat CSV with Python, joining repeated authors into one cell with correct quoting, and see why pandas read_xml dropped one.

PostgreSQL loads an unquoted empty field as NULL and a quoted one as an empty string. See the options that change that and the integer error one causes.

How -> and ->> read keys and array elements in PostgreSQL JSONB, what comes back for missing keys, and the precedence and casting traps that bite.

A working guide to openpyxl: the workbook model, reading values and formulas, writing and editing files, large-file modes, styles, charts and errors.

Index PostgreSQL full text search with GIN: how it works, GIN versus GiST, fastupdate and the pending list, build time, size and when the planner skips it.

One XML file converted to JSON, CSV, YAML and Excel with one parse and four writers, what each target loses, and how to prove nothing went missing.

Load a messy CSV as text first, then convert it with SQL. Build a three format date parser, a reject table with reasons, and the typed insert.

COPY cannot skip file columns. Compare two ways to load three of eight columns of a 2,000,000 row CSV, with timings, and see why cut breaks on quotes.

Load a Google Merchant style product feed into PostgreSQL with xmltable and a namespace, split price from currency, and handle missing GTINs and empty prices.

A working guide to JSONB in PostgreSQL 18: reading, filtering, updating, unnesting and aggregating documents, then GIN and expression indexes, with timings.

Skip the header, or better, check it. See what HEADER true, HEADER match and a column list do, and the errors when the file and the table disagree.