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...
This commit is contained in:
Tom Lane 2003-05-26 17:51:38 +00:00
parent b71a48990a
commit 8c43300ccc
1 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.73 2003/05/13 18:39:50 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.74 2003/05/26 17:51:38 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -286,7 +286,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
{ {
DR_printtup *myState = (DR_printtup *) self; DR_printtup *myState = (DR_printtup *) self;
StringInfoData buf; StringInfoData buf;
int natts = tuple->t_data->t_natts; int natts = typeinfo->natts;
int i; int i;
/* Set or update my derived attribute info, if needed */ /* Set or update my derived attribute info, if needed */
@ -370,7 +370,7 @@ printtup_20(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
{ {
DR_printtup *myState = (DR_printtup *) self; DR_printtup *myState = (DR_printtup *) self;
StringInfoData buf; StringInfoData buf;
int natts = tuple->t_data->t_natts; int natts = typeinfo->natts;
int i, int i,
j, j,
k; k;
@ -517,7 +517,7 @@ debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo)
void void
debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
{ {
int natts = tuple->t_data->t_natts; int natts = typeinfo->natts;
int i; int i;
Datum origattr, Datum origattr,
attr; attr;
@ -573,7 +573,7 @@ printtup_internal_20(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
{ {
DR_printtup *myState = (DR_printtup *) self; DR_printtup *myState = (DR_printtup *) self;
StringInfoData buf; StringInfoData buf;
int natts = tuple->t_data->t_natts; int natts = typeinfo->natts;
int i, int i,
j, j,
k; k;