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

Commit85113bc

Browse files
committed
Make ExecEvalFieldSelect throw a more intelligible error if it's asked to
extract a system column, and remove a couple of lines that are uselessin light of the fact that we aren't ever going to support this case. Thereisn't much point in trying to make this work because a tuple Datum doesnot carry many of the system columns. Per experimentation with a casereported by Dean Rasheed; we'll have to fix his problem somewhere else.
1 parent42edbd1 commit85113bc

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

‎src/backend/executor/execQual.c

Lines changed: 13 additions & 11 deletions
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.259 2010/01/02 16:57:41 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.260 2010/01/09 20:46:19 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -3766,12 +3766,20 @@ ExecEvalFieldSelect(FieldSelectState *fstate,
37663766
tupDesc=get_cached_rowtype(tupType,tupTypmod,
37673767
&fstate->argdesc,econtext);
37683768

3769-
/* Check for dropped column, and force a NULL result if so */
3770-
if (fieldnum <=0||
3771-
fieldnum>tupDesc->natts)/* should never happen */
3769+
/*
3770+
* Find field's attr record. Note we don't support system columns here:
3771+
* a datum tuple doesn't have valid values for most of the interesting
3772+
* system columns anyway.
3773+
*/
3774+
if (fieldnum <=0)/* should never happen */
3775+
elog(ERROR,"unsupported reference to system column %d in FieldSelect",
3776+
fieldnum);
3777+
if (fieldnum>tupDesc->natts)/* should never happen */
37723778
elog(ERROR,"attribute number %d exceeds number of columns %d",
37733779
fieldnum,tupDesc->natts);
37743780
attr=tupDesc->attrs[fieldnum-1];
3781+
3782+
/* Check for dropped column, and force a NULL result if so */
37753783
if (attr->attisdropped)
37763784
{
37773785
*isNull= true;
@@ -3787,14 +3795,8 @@ ExecEvalFieldSelect(FieldSelectState *fstate,
37873795
format_type_be(attr->atttypid),
37883796
format_type_be(fselect->resulttype))));
37893797

3790-
/*
3791-
* heap_getattr needs a HeapTuple not a bare HeapTupleHeader. We set all
3792-
* the fields in the struct just in case user tries to inspect system
3793-
* columns.
3794-
*/
3798+
/* heap_getattr needs a HeapTuple not a bare HeapTupleHeader */
37953799
tmptup.t_len=HeapTupleHeaderGetDatumLength(tuple);
3796-
ItemPointerSetInvalid(&(tmptup.t_self));
3797-
tmptup.t_tableOid=InvalidOid;
37983800
tmptup.t_data=tuple;
37993801

38003802
result=heap_getattr(&tmptup,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp