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

Commitcee1209

Browse files
committed
Support for custom slots in the custom executor nodes
Some custom table access method may have their tuple format and use customexecutor nodes for their custom scan types. The ability to set a custom slotwould save them from tuple format conversion. Other users of custom executornodes may also benefit.Discussion:https://postgr.es/m/CAPpHfduJUU6ToecvTyRE_yjxTS80FyPpct4OHaLFk3OEheMTNA@mail.gmail.comAuthor: Alexander KorotkovReviewed-by: Pavel Borisov
1 parentb7a5ef1 commitcee1209

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

‎src/backend/executor/nodeCustom.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ CustomScanState *
2929
ExecInitCustomScan(CustomScan*cscan,EState*estate,inteflags)
3030
{
3131
CustomScanState*css;
32+
constTupleTableSlotOps*slotOps;
3233
Relationscan_rel=NULL;
3334
Indexscanrelid=cscan->scan.scanrelid;
3435
inttlistvarno;
@@ -63,6 +64,14 @@ ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
6364
css->ss.ss_currentRelation=scan_rel;
6465
}
6566

67+
/*
68+
* Use a custom slot if specified in CustomScanState or use virtual slot
69+
* otherwise.
70+
*/
71+
slotOps=css->slotOps;
72+
if (!slotOps)
73+
slotOps=&TTSOpsVirtual;
74+
6675
/*
6776
* Determine the scan tuple type. If the custom scan provider provided a
6877
* targetlist describing the scan tuples, use that; else use base
@@ -73,14 +82,14 @@ ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
7382
TupleDescscan_tupdesc;
7483

7584
scan_tupdesc=ExecTypeFromTL(cscan->custom_scan_tlist);
76-
ExecInitScanTupleSlot(estate,&css->ss,scan_tupdesc,&TTSOpsVirtual);
85+
ExecInitScanTupleSlot(estate,&css->ss,scan_tupdesc,slotOps);
7786
/* Node's targetlist will contain Vars with varno = INDEX_VAR */
7887
tlistvarno=INDEX_VAR;
7988
}
8089
else
8190
{
8291
ExecInitScanTupleSlot(estate,&css->ss,RelationGetDescr(scan_rel),
83-
&TTSOpsVirtual);
92+
slotOps);
8493
/* Node's targetlist will contain Vars with varno = scanrelid */
8594
tlistvarno=scanrelid;
8695
}

‎src/include/nodes/execnodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,7 @@ typedef struct CustomScanState
19491949
List*custom_ps;/* list of child PlanState nodes, if any */
19501950
Sizepscan_len;/* size of parallel coordination information */
19511951
conststructCustomExecMethods*methods;
1952+
conststructTupleTableSlotOps*slotOps;
19521953
}CustomScanState;
19531954

19541955
/* ----------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp