aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-30 20:04:33 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-30 20:04:33 +0000
commitd7018abe0678e49d81c0d65689daa5b24c4a7f47 (patch)
treeeccd88954a741949d9c62f5f834171f93bdaf220 /src
parent93b24772782e7518dee2f85366aa7a80a2beb937 (diff)
downloadpostgresql-d7018abe0678e49d81c0d65689daa5b24c4a7f47.tar.gz
postgresql-d7018abe0678e49d81c0d65689daa5b24c4a7f47.zip
Make record_out and record_send extract type information from the passed
record object itself, rather than relying on a second OID argument to be correct. This patch just changes the function behavior and not the catalogs, so it's OK to back-patch to 8.0. Will remove the now-redundant second argument in pg_proc in a separate patch in HEAD only.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/rowtypes.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index 79f04a124ee..090158d34a5 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.9 2005/04/18 17:11:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.10 2005/04/30 20:04:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -268,7 +268,7 @@ Datum
record_out(PG_FUNCTION_ARGS)
{
HeapTupleHeader rec = PG_GETARG_HEAPTUPLEHEADER(0);
- Oid tupType = PG_GETARG_OID(1);
+ Oid tupType;
int32 tupTypmod;
TupleDesc tupdesc;
HeapTupleData tuple;
@@ -280,18 +280,9 @@ record_out(PG_FUNCTION_ARGS)
char *nulls;
StringInfoData buf;
- /*
- * Use the passed type unless it's RECORD; in that case, we'd better
- * get the type info out of the datum itself. Note that for RECORD,
- * what we'll probably actually get is RECORD's typelem, ie, zero.
- */
- if (tupType == InvalidOid || tupType == RECORDOID)
- {
- tupType = HeapTupleHeaderGetTypeId(rec);
- tupTypmod = HeapTupleHeaderGetTypMod(rec);
- }
- else
- tupTypmod = -1;
+ /* Extract type info from the tuple itself */
+ tupType = HeapTupleHeaderGetTypeId(rec);
+ tupTypmod = HeapTupleHeaderGetTypMod(rec);
tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod);
ncolumns = tupdesc->natts;
@@ -613,7 +604,7 @@ Datum
record_send(PG_FUNCTION_ARGS)
{
HeapTupleHeader rec = PG_GETARG_HEAPTUPLEHEADER(0);
- Oid tupType = PG_GETARG_OID(1);
+ Oid tupType;
int32 tupTypmod;
TupleDesc tupdesc;
HeapTupleData tuple;
@@ -625,18 +616,9 @@ record_send(PG_FUNCTION_ARGS)
char *nulls;
StringInfoData buf;
- /*
- * Use the passed type unless it's RECORD; in that case, we'd better
- * get the type info out of the datum itself. Note that for RECORD,
- * what we'll probably actually get is RECORD's typelem, ie, zero.
- */
- if (tupType == InvalidOid || tupType == RECORDOID)
- {
- tupType = HeapTupleHeaderGetTypeId(rec);
- tupTypmod = HeapTupleHeaderGetTypMod(rec);
- }
- else
- tupTypmod = -1;
+ /* Extract type info from the tuple itself */
+ tupType = HeapTupleHeaderGetTypeId(rec);
+ tupTypmod = HeapTupleHeaderGetTypMod(rec);
tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod);
ncolumns = tupdesc->natts;