Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7018ab

Browse files
committed
Make record_out and record_send extract type information from the passed
record object itself, rather than relying on a second OID argument to becorrect. This patch just changes the function behavior and not thecatalogs, so it's OK to back-patch to 8.0. Will remove the now-redundantsecond argument in pg_proc in a separate patch in HEAD only.
1 parent93b2477 commitd7018ab

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

‎src/backend/utils/adt/rowtypes.c

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.9 2005/04/18 17:11:05 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.10 2005/04/30 20:04:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -268,7 +268,7 @@ Datum
268268
record_out(PG_FUNCTION_ARGS)
269269
{
270270
HeapTupleHeaderrec=PG_GETARG_HEAPTUPLEHEADER(0);
271-
OidtupType=PG_GETARG_OID(1);
271+
OidtupType;
272272
int32tupTypmod;
273273
TupleDesctupdesc;
274274
HeapTupleDatatuple;
@@ -280,18 +280,9 @@ record_out(PG_FUNCTION_ARGS)
280280
char*nulls;
281281
StringInfoDatabuf;
282282

283-
/*
284-
* Use the passed type unless it's RECORD; in that case, we'd better
285-
* get the type info out of the datum itself. Note that for RECORD,
286-
* what we'll probably actually get is RECORD's typelem, ie, zero.
287-
*/
288-
if (tupType==InvalidOid||tupType==RECORDOID)
289-
{
290-
tupType=HeapTupleHeaderGetTypeId(rec);
291-
tupTypmod=HeapTupleHeaderGetTypMod(rec);
292-
}
293-
else
294-
tupTypmod=-1;
283+
/* Extract type info from the tuple itself */
284+
tupType=HeapTupleHeaderGetTypeId(rec);
285+
tupTypmod=HeapTupleHeaderGetTypMod(rec);
295286
tupdesc=lookup_rowtype_tupdesc(tupType,tupTypmod);
296287
ncolumns=tupdesc->natts;
297288

@@ -613,7 +604,7 @@ Datum
613604
record_send(PG_FUNCTION_ARGS)
614605
{
615606
HeapTupleHeaderrec=PG_GETARG_HEAPTUPLEHEADER(0);
616-
OidtupType=PG_GETARG_OID(1);
607+
OidtupType;
617608
int32tupTypmod;
618609
TupleDesctupdesc;
619610
HeapTupleDatatuple;
@@ -625,18 +616,9 @@ record_send(PG_FUNCTION_ARGS)
625616
char*nulls;
626617
StringInfoDatabuf;
627618

628-
/*
629-
* Use the passed type unless it's RECORD; in that case, we'd better
630-
* get the type info out of the datum itself. Note that for RECORD,
631-
* what we'll probably actually get is RECORD's typelem, ie, zero.
632-
*/
633-
if (tupType==InvalidOid||tupType==RECORDOID)
634-
{
635-
tupType=HeapTupleHeaderGetTypeId(rec);
636-
tupTypmod=HeapTupleHeaderGetTypMod(rec);
637-
}
638-
else
639-
tupTypmod=-1;
619+
/* Extract type info from the tuple itself */
620+
tupType=HeapTupleHeaderGetTypeId(rec);
621+
tupTypmod=HeapTupleHeaderGetTypMod(rec);
640622
tupdesc=lookup_rowtype_tupdesc(tupType,tupTypmod);
641623
ncolumns=tupdesc->natts;
642624

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp