mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
While perusing SQL92 I realized that we are delivering the wrong SQLSTATE
error code for string-too-long errors. It should be STRING_DATA_RIGHT_TRUNCATION not STRING_DATA_LENGTH_MISMATCH. The latter probably should only be applied to cases where a string must be exactly so many bits --- there are no cases at all where it applies to character strings, only bit strings.
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.39 2004/06/16 01:26:47 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.40 2004/08/02 16:51:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -344,7 +344,7 @@ varbit_in(PG_FUNCTION_ARGS)
|
||||
atttypmod = bitlen;
|
||||
else if (bitlen > atttypmod)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_STRING_DATA_LENGTH_MISMATCH),
|
||||
(errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
|
||||
errmsg("bit string too long for type bit varying(%d)",
|
||||
atttypmod)));
|
||||
|
||||
@ -528,7 +528,7 @@ varbit(PG_FUNCTION_ARGS)
|
||||
|
||||
if (!isExplicit)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_STRING_DATA_LENGTH_MISMATCH),
|
||||
(errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
|
||||
errmsg("bit string too long for type bit varying(%d)",
|
||||
len)));
|
||||
|
||||
|
Reference in New Issue
Block a user