Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8c43300

Browse files
committed
Make sure printtup() always sends the number of columns previously
advertised in RowDescription message. Depending on the physical tuple's column count is not really correct, since according to heap_getattr() conventions the tuple may be short some columns, which will automatically get read as nulls. Problem has been latent since forever, but was only exposed by recent change to skip a projection step in SELECT * FROM...
1 parent b71a489 commit 8c43300

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/access/common/printtup.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.73 2003/05/13 18:39:50 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.74 2003/05/26 17:51:38 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -286,7 +286,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
286286
{
287287
DR_printtup *myState = (DR_printtup *) self;
288288
StringInfoData buf;
289-
int natts = tuple->t_data->t_natts;
289+
int natts = typeinfo->natts;
290290
int i;
291291

292292
/* Set or update my derived attribute info, if needed */
@@ -370,7 +370,7 @@ printtup_20(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
370370
{
371371
DR_printtup *myState = (DR_printtup *) self;
372372
StringInfoData buf;
373-
int natts = tuple->t_data->t_natts;
373+
int natts = typeinfo->natts;
374374
int i,
375375
j,
376376
k;
@@ -517,7 +517,7 @@ debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo)
517517
void
518518
debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
519519
{
520-
int natts = tuple->t_data->t_natts;
520+
int natts = typeinfo->natts;
521521
int i;
522522
Datum origattr,
523523
attr;
@@ -573,7 +573,7 @@ printtup_internal_20(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
573573
{
574574
DR_printtup *myState = (DR_printtup *) self;
575575
StringInfoData buf;
576-
int natts = tuple->t_data->t_natts;
576+
int natts = typeinfo->natts;
577577
int i,
578578
j,
579579
k;

0 commit comments

Comments
 (0)