aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/print.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-06-06 00:41:28 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-06-06 00:41:28 +0000
commitc541bb86e9ec8fed37b23df6a0df703d0bde4dfa (patch)
treeb4cff96eecc86e338274ec5d7355918efe9c149e /src/backend/nodes/print.c
parentc3a153afed84e29dac664bdc6123724a9e3a906f (diff)
downloadpostgresql-c541bb86e9ec8fed37b23df6a0df703d0bde4dfa.tar.gz
postgresql-c541bb86e9ec8fed37b23df6a0df703d0bde4dfa.zip
Infrastructure for I/O of composite types: arrange for the I/O routines
of a composite type to get that type's OID as their second parameter, in place of typelem which is useless. The actual changes are mostly centralized in getTypeInputInfo and siblings, but I had to fix a few places that were fetching pg_type.typelem for themselves instead of using the lsyscache.c routines. Also, I renamed all the related variables from 'typelem' to 'typioparam' to discourage people from assuming that they necessarily contain array element types.
Diffstat (limited to 'src/backend/nodes/print.c')
-rw-r--r--src/backend/nodes/print.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index 4934c09e2b3..035bb7aa65e 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.68 2004/05/30 23:40:27 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.69 2004/06/06 00:41:26 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -20,7 +20,6 @@
#include "postgres.h"
#include "access/printtup.h"
-#include "catalog/pg_type.h"
#include "lib/stringinfo.h"
#include "nodes/print.h"
#include "optimizer/clauses.h"
@@ -345,9 +344,9 @@ print_expr(Node *expr, List *rtable)
else if (IsA(expr, Const))
{
Const *c = (Const *) expr;
- HeapTuple typeTup;
Oid typoutput;
- Oid typelem;
+ Oid typioparam;
+ bool typIsVarlena;
char *outputstr;
if (c->constisnull)
@@ -356,18 +355,12 @@ print_expr(Node *expr, List *rtable)
return;
}
- typeTup = SearchSysCache(TYPEOID,
- ObjectIdGetDatum(c->consttype),
- 0, 0, 0);
- if (!HeapTupleIsValid(typeTup))
- elog(ERROR, "cache lookup failed for type %u", c->consttype);
- typoutput = ((Form_pg_type) GETSTRUCT(typeTup))->typoutput;
- typelem = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
- ReleaseSysCache(typeTup);
+ getTypeOutputInfo(c->consttype,
+ &typoutput, &typioparam, &typIsVarlena);
outputstr = DatumGetCString(OidFunctionCall3(typoutput,
c->constvalue,
- ObjectIdGetDatum(typelem),
+ ObjectIdGetDatum(typioparam),
Int32GetDatum(-1)));
printf("%s", outputstr);
pfree(outputstr);