agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: killerwzb@gmail.com
Subject: BUG #19642: Include column name in error message when varchar(n) length limit is exceeded
Date: Fri, 28 Aug 2026 04:28:42 +0000
Message-ID: <19642-5e93d3e409f1387c@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 19642
Logged by: zhibin wang
Email address: killerwzb@gmail.com
PostgreSQL version: 18.4
Operating system: centos7
Description:
Dear PostgreSQL Developers,
I am writing to suggest an improvement to the error reporting mechanism for
data type length constraints.
Currently, when an insertion fails due to exceeding the varchar(n) limit,
the error message only states that the value is too long for the type, but
it does not specify which column caused the failure.
1. Current Behavior:
When executing:
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(10) NOT NULL,
email VARCHAR(255)
);
INSERT INTO users (username) VALUES ('123456789012'); -- 12 chars
The error returned is:
ERROR: value too long for type character varying(10)
2. The Pain Point:
In tables with many columns (e.g., a wide table with 50+ columns), or when
performing bulk inserts via ORM/ETL tools, it is often difficult to
immediately identify which specific column triggered this generic error.
Developers have to manually check the length of every input field against
the schema definition.
3. Suggestion:
It would be extremely helpful if the error message could explicitly include
the column name.
Proposed Error Message Format:
ERROR: value too long for column "username" (type character varying(10))
Or alternatively:
ERROR: value too long for type character varying(10) in column "username"
4. Benefits:
Faster Debugging: Developers can instantly locate the problematic field
without guessing.
Better UX for Tools: GUI clients and ORMs can parse this error more
accurately to highlight the specific field in the UI.
Thank you for considering this suggestion to improve the developer
experience!
Best regards,
Zhibin Wang.
view thread (2+ messages) latest in thread
Message-ID: <19642-5e93d3e409f1387c@postgresql.org>
Permalink: ../19642-5e93d3e409f1387c@postgresql.org/
Also on: postgresql.org/message-id/19642-5e93d3e409f1387c@postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, killerwzb@gmail.com
Subject: Re: BUG #19642: Include column name in error message when varchar(n) length limit is exceeded
In-Reply-To: <19642-5e93d3e409f1387c@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox