PostgreSQL 16-18 json casts fail on invalid inputs by node-postgres and psycopg

now-next.nl12 min read

An analysis of PostgreSQL errors caused by invalid input syntax when casting text to json or jsonb types reveals how different drivers, such as node-postgres and psycopg, handle unsupported data types and structures. The author tests 38 input variations across PostgreSQL versions 16, 17, and 18, demonstrating why certain checks like IS JSON fail to prevent migration errors and evaluating methods for safely casting columns without aborting queries. Open article →