mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Improve unique-constraint-violation error messages to include the exact
values being complained of. In passing, also remove the arbitrary length limitation in the similar error detail message for foreign key violations. Itagaki Takahiro
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.88 2009/06/11 14:48:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.89 2009/08/01 19:59:41 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -432,6 +432,27 @@ nocache_index_getattr(IndexTuple tup,
|
||||
return fetchatt(att[attnum], tp + off);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an index tuple into Datum/isnull arrays.
|
||||
*
|
||||
* The caller must allocate sufficient storage for the output arrays.
|
||||
* (INDEX_MAX_KEYS entries should be enough.)
|
||||
*/
|
||||
void
|
||||
index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
|
||||
Datum *values, bool *isnull)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Assert to protect callers who allocate fixed-size arrays */
|
||||
Assert(tupleDescriptor->natts <= INDEX_MAX_KEYS);
|
||||
|
||||
for (i = 0; i < tupleDescriptor->natts; i++)
|
||||
{
|
||||
values[i] = index_getattr(tup, i + 1, tupleDescriptor, &isnull[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a palloc'd copy of an index tuple.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user