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

Commit6ad698c

Browse files
author
Thomas G. Lockhart
committed
Add some printing capability for a few more node types (CreateStmt,
IndexStmt, IndexElem, ColumnDef).
1 parent0295864 commit6ad698c

File tree

1 file changed

+112
-7
lines changed

1 file changed

+112
-7
lines changed

‎src/backend/nodes/outfuncs.c

Lines changed: 112 additions & 7 deletions
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.10 1997/09/08 21:44:07 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.11 1997/12/04 23:20:32 thomas Exp $
1111
*
1212
* NOTES
1313
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -67,6 +67,70 @@ _outIntList(StringInfo str, List *list)
6767
appendStringInfo(str,")");
6868
}
6969

70+
staticvoid
71+
_outCreateStmt(StringInfostr,CreateStmt*node)
72+
{
73+
charbuf[500];
74+
75+
sprintf(buf,"CREATE");
76+
appendStringInfo(str,buf);
77+
78+
sprintf(buf," :relname %s",node->relname);
79+
appendStringInfo(str,buf);
80+
appendStringInfo(str," :columns");
81+
_outNode(str,node->tableElts);
82+
}/* _outCreateStmt() */
83+
84+
staticvoid
85+
_outIndexStmt(StringInfostr,IndexStmt*node)
86+
{
87+
charbuf[500];
88+
89+
sprintf(buf,"INDEX");
90+
appendStringInfo(str,buf);
91+
92+
sprintf(buf," :idxname %s",node->idxname);
93+
appendStringInfo(str,buf);
94+
sprintf(buf," :relname %s",node->relname);
95+
appendStringInfo(str,buf);
96+
sprintf(buf," :method %s",node->accessMethod);
97+
appendStringInfo(str,buf);
98+
sprintf(buf," :unique %s", (node->unique?"y":"n"));
99+
appendStringInfo(str,buf);
100+
appendStringInfo(str," :columns");
101+
_outNode(str,node->indexParams);
102+
}/* _outIndexStmt() */
103+
104+
staticvoid
105+
_outColumnDef(StringInfostr,ColumnDef*node)
106+
{
107+
charbuf[500];
108+
109+
sprintf(buf,"COLUMNDEF");
110+
appendStringInfo(str,buf);
111+
112+
sprintf(buf," :colname %s",node->colname);
113+
appendStringInfo(str,buf);
114+
appendStringInfo(str," :typename");
115+
_outNode(str,node->typename);
116+
}/* _outColumnDef() */
117+
118+
staticvoid
119+
_outIndexElem(StringInfostr,IndexElem*node)
120+
{
121+
charbuf[500];
122+
123+
sprintf(buf,"INDEXELEM");
124+
appendStringInfo(str,buf);
125+
126+
sprintf(buf," :name %s",node->name);
127+
appendStringInfo(str,buf);
128+
sprintf(buf," :class %s",node->class);
129+
appendStringInfo(str,buf);
130+
appendStringInfo(str," :tname");
131+
_outNode(str,node->tname);
132+
}/* _outIndexElem() */
133+
70134
staticvoid
71135
_outQuery(StringInfostr,Query*node)
72136
{
@@ -77,14 +141,41 @@ _outQuery(StringInfo str, Query *node)
77141

78142
sprintf(buf," :command %d",node->commandType);
79143
appendStringInfo(str,buf);
80-
if (node->utilityStmt&&
81-
nodeTag(node->utilityStmt)==T_NotifyStmt)
82-
sprintf(buf," :utility %s",
83-
((NotifyStmt*) (node->utilityStmt))->relname);
144+
if (node->utilityStmt)
145+
{
146+
switch (nodeTag(node->utilityStmt))
147+
{
148+
caseT_CreateStmt:
149+
sprintf(buf," :create %s",
150+
((CreateStmt*) (node->utilityStmt))->relname);
151+
appendStringInfo(str,buf);
152+
_outNode(str,node->utilityStmt);
153+
break;
154+
155+
caseT_IndexStmt:
156+
sprintf(buf," :index %s on %s",
157+
((IndexStmt*) (node->utilityStmt))->idxname,
158+
((IndexStmt*) (node->utilityStmt))->relname);
159+
appendStringInfo(str,buf);
160+
_outNode(str,node->utilityStmt);
161+
break;
162+
163+
caseT_NotifyStmt:
164+
sprintf(buf," :utility %s",
165+
((NotifyStmt*) (node->utilityStmt))->relname);
166+
appendStringInfo(str,buf);
167+
break;
168+
169+
default:
170+
sprintf(buf," :utility ?");
171+
appendStringInfo(str,buf);
172+
}
173+
}
84174
else
175+
{
85176
/* use "" to designate*/
86-
sprintf(buf," :utility \"\"");
87-
appendStringInfo(str,buf);
177+
appendStringInfo(str," :utility \"\"");
178+
}
88179

89180
sprintf(buf," :resrel %d",node->resultRelation);
90181
appendStringInfo(str,buf);
@@ -1527,6 +1618,20 @@ _outNode(StringInfo str, void *obj)
15271618
appendStringInfo(str,"{");
15281619
switch (nodeTag(obj))
15291620
{
1621+
caseT_CreateStmt:
1622+
_outCreateStmt(str,obj);
1623+
break;
1624+
caseT_IndexStmt:
1625+
_outIndexStmt(str,obj);
1626+
break;
1627+
1628+
caseT_ColumnDef:
1629+
_outColumnDef(str,obj);
1630+
break;
1631+
caseT_IndexElem:
1632+
_outIndexElem(str,obj);
1633+
break;
1634+
15301635
caseT_Query:
15311636
_outQuery(str,obj);
15321637
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp