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

Commitb37bc65

Browse files
committed
Creates the SubLink structure, and the Query->hasSubLink field,
with supporting code.Creates SubLink node in gram.y.psql.c patch for newatttypmod field.
1 parentc65ea0e commitb37bc65

File tree

10 files changed

+205
-113
lines changed

10 files changed

+205
-113
lines changed

‎src/backend/nodes/copyfuncs.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.31 1998/01/16 23:19:56 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.32 1998/01/17 04:53:07 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -892,6 +892,28 @@ _copyAggreg(Aggreg *from)
892892
returnnewnode;
893893
}
894894

895+
/* ----------------
896+
*_copySubLink
897+
* ----------------
898+
*/
899+
staticSubLink*
900+
_copySubLink(SubLink*from)
901+
{
902+
SubLink*newnode=makeNode(SubLink);
903+
904+
/* ----------------
905+
*copy remainder of node
906+
* ----------------
907+
*/
908+
newnode->subLinkType=from->subLinkType;
909+
newnode->useor=from->useor;
910+
Node_Copy(from,newnode,lefthand);
911+
Node_Copy(from,newnode,oper);
912+
Node_Copy(from,newnode,subselect);
913+
914+
returnnewnode;
915+
}
916+
895917
staticArray*
896918
_copyArray(Array*from)
897919
{
@@ -1517,6 +1539,7 @@ _copyQuery(Query *from)
15171539
Node_Copy(from,newnode,havingQual);
15181540

15191541
newnode->hasAggs=from->hasAggs;
1542+
newnode->hasSubLinks=from->hasSubLinks;
15201543

15211544
if (from->unionClause)
15221545
{
@@ -1673,6 +1696,9 @@ copyObject(void *from)
16731696
caseT_Aggreg:
16741697
retval=_copyAggreg(from);
16751698
break;
1699+
caseT_SubLink:
1700+
retval=_copySubLink(from);
1701+
break;
16761702

16771703
/*
16781704
* RELATION NODES

‎src/backend/nodes/outfuncs.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.22 1998/01/16 23:19:59 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.23 1998/01/17 04:53:09 momjian Exp $
1111
*
1212
* NOTES
1313
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -230,6 +230,8 @@ _outQuery(StringInfo str, Query *node)
230230
_outNode(str,node->havingQual);
231231
appendStringInfo(str," :hasAggs ");
232232
appendStringInfo(str, (node->hasAggs ?"true" :"false"));
233+
appendStringInfo(str," :hasSubLinks ");
234+
appendStringInfo(str, (node->hasSubLinks ?"true" :"false"));
233235
appendStringInfo(str," :unionClause ");
234236
_outNode(str,node->unionClause);
235237
}
@@ -753,6 +755,27 @@ _outAggreg(StringInfo str, Aggreg *node)
753755
appendStringInfo(str,node->usenulls ?"true" :"false");
754756
}
755757

758+
/*
759+
*SubLink
760+
*/
761+
staticvoid
762+
_outSubLink(StringInfostr,SubLink*node)
763+
{
764+
charbuf[500];
765+
766+
appendStringInfo(str,"SUBLINK");
767+
sprintf(buf," :subLinkType %d ",node->subLinkType);
768+
appendStringInfo(str,buf);
769+
appendStringInfo(str," :useor ");
770+
appendStringInfo(str,node->useor ?"true" :"false");
771+
appendStringInfo(str," :lefthand ");
772+
_outNode(str,node->lefthand);
773+
appendStringInfo(str," :oper ");
774+
_outNode(str,node->oper);
775+
appendStringInfo(str," :subselect ");
776+
_outNode(str,node->subselect);
777+
}
778+
756779
/*
757780
*Array is a subclass of Expr
758781
*/
@@ -1648,6 +1671,9 @@ _outNode(StringInfo str, void *obj)
16481671
caseT_Aggreg:
16491672
_outAggreg(str,obj);
16501673
break;
1674+
caseT_SubLink:
1675+
_outSubLink(str,obj);
1676+
break;
16511677
caseT_Array:
16521678
_outArray(str,obj);
16531679
break;

‎src/backend/nodes/readfuncs.c

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.18 1998/01/15 18:59:31 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.19 1998/01/17 04:53:11 momjian Exp $
1111
*
1212
* NOTES
1313
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -156,6 +156,10 @@ _readQuery()
156156
token=lsptok(NULL,&length);/* get hasAggs */
157157
local_node->hasAggs= (token[0]=='t') ? true : false;
158158

159+
token=lsptok(NULL,&length);/* skip the :hasSubLinks */
160+
token=lsptok(NULL,&length);/* get hasSubLinks */
161+
local_node->hasSubLinks= (token[0]=='t') ? true : false;
162+
159163
token=lsptok(NULL,&length);/* skip :unionClause */
160164
local_node->unionClause=nodeRead(true);
161165

@@ -1151,6 +1155,41 @@ _readAggreg()
11511155
return (local_node);
11521156
}
11531157

1158+
/* ----------------
1159+
*_readSubLink
1160+
*
1161+
*SubLink is a subclass of Node
1162+
* ----------------
1163+
*/
1164+
staticSubLink*
1165+
_readSubLink()
1166+
{
1167+
SubLink*local_node;
1168+
char*token;
1169+
intlength;
1170+
1171+
local_node=makeNode(SubLink);
1172+
1173+
token=lsptok(NULL,&length);/* eat :subLinkType */
1174+
token=lsptok(NULL,&length);/* get subLinkType */
1175+
local_node->subLinkType=atoi(token);
1176+
1177+
token=lsptok(NULL,&length);/* eat :useor */
1178+
token=lsptok(NULL,&length);/* get useor */
1179+
local_node->useor= (token[0]=='t') ? true : false;
1180+
1181+
token=lsptok(NULL,&length);/* eat :lefthand */
1182+
local_node->lefthand=nodeRead(true);/* now read it */
1183+
1184+
token=lsptok(NULL,&length);/* eat :oper */
1185+
local_node->oper=nodeRead(true);/* now read it */
1186+
1187+
token=lsptok(NULL,&length);/* eat :subselect */
1188+
local_node->subselect=nodeRead(true);/* now read it */
1189+
1190+
return (local_node);
1191+
}
1192+
11541193
/*
11551194
*Stuff from execnodes.h
11561195
*/
@@ -1971,6 +2010,10 @@ parsePlanString(void)
19712010
{
19722011
return_value=_readAggreg();
19732012
}
2013+
elseif (!strncmp(token,"SUBLINK",6))
2014+
{
2015+
return_value=_readSubLink();
2016+
}
19742017
elseif (!strncmp(token,"AGG",3))
19752018
{
19762019
return_value=_readAgg();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp