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

Commitdb2d9c6

Browse files
committed
Fix ExecMakeTableFunctionResult to verify that all rows returned by a SRF
returning "record" actually do have the same rowtype. This is needed becausethe parser can't realistically enforce that they will all have the same typmod,as seen in a recent example from David Wheeler.Back-patch to 8.0, which is as far back as we have the notion of RECORDsubtypes being distinguished by typmod. Wheeler's example depends on8.4-and-up features, but I suspect there may be ways to provoke similarfailures before 8.4.
1 parent39ce62b commitdb2d9c6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎src/backend/executor/execQual.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.264 2010/07/12 17:01:05 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.265 2010/08/26 18:54:37 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2143,6 +2143,16 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
21432143

21442144
td=DatumGetHeapTupleHeader(result);
21452145

2146+
/*
2147+
* Verify all returned rows have same subtype; necessary in
2148+
* case the type is RECORD.
2149+
*/
2150+
if (HeapTupleHeaderGetTypeId(td)!=tupdesc->tdtypeid||
2151+
HeapTupleHeaderGetTypMod(td)!=tupdesc->tdtypmod)
2152+
ereport(ERROR,
2153+
(errcode(ERRCODE_DATATYPE_MISMATCH),
2154+
errmsg("rows returned by function are not all of the same row type")));
2155+
21462156
/*
21472157
* tuplestore_puttuple needs a HeapTuple not a bare
21482158
* HeapTupleHeader, but it doesn't need all the fields.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp