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

Commitd468e19

Browse files
committed
Allow implicit cast from any named composite type to RECORD. At the
moment this has no particular use except to allow table rows to bepassed to record_out(), but that case seems to be useful in itselfper recent example from Elein. Further down the road we could lookat letting PL functions be declared to accept RECORD parameters.
1 parent13f75e3 commitd468e19

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎src/backend/parser/parse_coerce.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.127 2005/03/29 00:17:04 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.128 2005/05/05 00:19:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -318,6 +318,13 @@ coerce_type(ParseState *pstate, Node *node,
318318
returncoerce_record_to_complex(pstate,node,targetTypeId,
319319
ccontext,cformat);
320320
}
321+
if (targetTypeId==RECORDOID&&
322+
ISCOMPLEX(inputTypeId))
323+
{
324+
/* Coerce a specific complex type to RECORD */
325+
/* NB: we do NOT want a RelabelType here */
326+
returnnode;
327+
}
321328
if (typeInheritsFrom(inputTypeId,targetTypeId))
322329
{
323330
/*
@@ -405,6 +412,13 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
405412
ISCOMPLEX(targetTypeId))
406413
continue;
407414

415+
/*
416+
* If input is a composite type and target is RECORD, accept
417+
*/
418+
if (targetTypeId==RECORDOID&&
419+
ISCOMPLEX(inputTypeId))
420+
continue;
421+
408422
/*
409423
* If input is a class type that inherits from target, accept
410424
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp