mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
Remove partial, broken support for NULL pointers when fetching attributes.
Previously, fastgetattr() and heap_getattr() tested their fourth argument against a null pointer, but any attempt to use them with a literal-NULL fourth argument evaluated to *(void *)0, resulting in a compiler error. Remove these NULL tests to avoid leading future readers of this code to believe that this has a chance of working. Also clean up related legacy code in nocachegetattr(), heap_getsysattr(), and nocache_index_getattr(). The new coding standard is that any code which calls a getattr-type function or macro which takes an isnull argument MUST pass a valid boolean pointer. Per discussion with Bruce Momjian, Tom Lane, Alvaro Herrera.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.280 2010/01/02 16:57:34 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.281 2010/01/10 04:26:36 rhaas Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -834,7 +834,7 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
|
||||
return (
|
||||
(attnum) > 0 ?
|
||||
(
|
||||
((isnull) ? (*(isnull) = false) : (dummyret) NULL),
|
||||
(*(isnull) = false),
|
||||
HeapTupleNoNulls(tup) ?
|
||||
(
|
||||
(tupleDesc)->attrs[(attnum) - 1]->attcacheoff >= 0 ?
|
||||
@ -844,18 +844,18 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
|
||||
(tupleDesc)->attrs[(attnum) - 1]->attcacheoff)
|
||||
)
|
||||
:
|
||||
nocachegetattr((tup), (attnum), (tupleDesc), (isnull))
|
||||
nocachegetattr((tup), (attnum), (tupleDesc))
|
||||
)
|
||||
:
|
||||
(
|
||||
att_isnull((attnum) - 1, (tup)->t_data->t_bits) ?
|
||||
(
|
||||
((isnull) ? (*(isnull) = true) : (dummyret) NULL),
|
||||
(*(isnull) = true),
|
||||
(Datum) NULL
|
||||
)
|
||||
:
|
||||
(
|
||||
nocachegetattr((tup), (attnum), (tupleDesc), (isnull))
|
||||
nocachegetattr((tup), (attnum), (tupleDesc))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user