mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
From: Massimo Dal Zotto <dz@cs.unitn.it>
After some playing with gdb I found that in printtup() there is a non null attribute with typeinfo->attrs[i]->atttypid = 0 (invalid oid). Unfortunately attibutes with invalid type are neither printed nor marked as null, and this explains why psql doesn't get all the expected data. So I made this patch to printtup():
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.32 1998/08/19 02:00:54 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.33 1998/08/30 19:30:38 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@@ -123,9 +123,11 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
|
|||||||
for (i = 0; i < tuple->t_natts; ++i)
|
for (i = 0; i < tuple->t_natts; ++i)
|
||||||
{
|
{
|
||||||
attr = heap_getattr(tuple, i + 1, typeinfo, &isnull);
|
attr = heap_getattr(tuple, i + 1, typeinfo, &isnull);
|
||||||
typoutput = typtoout((Oid) typeinfo->attrs[i]->atttypid);
|
if (isnull)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!isnull && OidIsValid(typoutput))
|
typoutput = typtoout((Oid) typeinfo->attrs[i]->atttypid);
|
||||||
|
if (OidIsValid(typoutput))
|
||||||
{
|
{
|
||||||
outputstr = fmgr(typoutput, attr,
|
outputstr = fmgr(typoutput, attr,
|
||||||
gettypelem(typeinfo->attrs[i]->atttypid),
|
gettypelem(typeinfo->attrs[i]->atttypid),
|
||||||
@@ -140,6 +142,12 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
|
|||||||
#endif
|
#endif
|
||||||
pfree(outputstr);
|
pfree(outputstr);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outputstr = "<unprintable>";
|
||||||
|
pq_putint(strlen(outputstr) + VARHDRSZ, VARHDRSZ);
|
||||||
|
pq_putnchar(outputstr, strlen(outputstr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user