agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedBUG #19642: Include column name in error message when varchar(n) length limit is exceeded
2+ messages / 2 participants
[nested] [flat]
* BUG #19642: Include column name in error message when varchar(n) length limit is exceeded
@ 2026-08-28 04:28 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2026-08-28 04:28 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: killerwzb@gmail.com
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #19642: Include column name in error message when varchar(n) length limit is exceeded
@ 2026-08-28 13:16 David G. Johnston <david.g.johnston@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2026-08-28 13:16 UTC (permalink / raw)
To: killerwzb@gmail.com; pgsql-bugs@lists.postgresql.org
On Fri, Aug 28, 2026 at 8:57 AM PG Bug reporting form <
noreply@postgresql.org> wrote:
> 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.
>
>
This is not a bug; and it is a frequent feature request you should be able
to find prior discussions for in the mailing list archives.
If you think you can contribute to moving efforts forward on getting
something like this implemented you should peruse the archives to figure
out why it hasn't been accomplished yet. Otherwise, just know that your
voice has been heard and it may or may not be something that gets
implemented in the future.
David J.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-08-28 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28 04:28 BUG #19642: Include column name in error message when varchar(n) length limit is exceeded PG Bug reporting form <noreply@postgresql.org>
2026-08-28 13:16 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox