Skip to content

Commit 3e248ed

Browse files
committed
Added _readAggreg() to work with T_Aggreg type.
1 parent 8ce8d65 commit 3e248ed

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

src/backend/nodes/readfuncs.c

Lines changed: 42 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.4 1996/11/10 03:00:51 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.5 1997/05/12 07:17:23 vadim Exp $
1111
*
1212
* NOTES
1313
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -1015,6 +1015,45 @@ _readParam()
10151015
return(local_node);
10161016
}
10171017

1018+
/* ----------------
1019+
* _readAggreg
1020+
*
1021+
* Aggreg is a subclass of Node
1022+
* ----------------
1023+
*/
1024+
static Aggreg *
1025+
_readAggreg()
1026+
{
1027+
Aggreg *local_node;
1028+
char *token;
1029+
int length;
1030+
1031+
local_node = makeNode(Aggreg);
1032+
1033+
token = lsptok(NULL, &length); /* eat :aggname */
1034+
token = lsptok(NULL, &length); /* get aggname */
1035+
local_node->aggname = (char*) palloc (length + 1);
1036+
memset (local_node->aggname, 0, length + 1);
1037+
strncpy (local_node->aggname, token, length);
1038+
1039+
token = lsptok(NULL, &length); /* eat :basetype */
1040+
token = lsptok(NULL, &length); /* get basetype */
1041+
local_node->basetype = (Oid)atol(token);
1042+
1043+
token = lsptok(NULL, &length); /* eat :aggtype */
1044+
token = lsptok(NULL, &length); /* get aggtype */
1045+
local_node->aggtype = (Oid)atol(token);
1046+
1047+
token = lsptok(NULL, &length); /* eat :aggno */
1048+
token = lsptok(NULL, &length); /* get aggno */
1049+
local_node->aggno = atoi(token);
1050+
1051+
token = lsptok(NULL, &length); /* eat :target */
1052+
local_node->target = nodeRead(true); /* now read it */
1053+
1054+
return(local_node);
1055+
}
1056+
10181057
/*
10191058
* Stuff from execnodes.h
10201059
*/
@@ -1822,6 +1861,8 @@ parsePlanString(void)
18221861
return_value = _readTemp();
18231862
}else if (!strncmp(token, "SORT", 4)) {
18241863
return_value = _readSort();
1864+
}else if (!strncmp(token, "AGGREG", 6)) {
1865+
return_value = _readAggreg();
18251866
}else if (!strncmp(token, "AGG", 3)) {
18261867
return_value = _readAgg();
18271868
}else if (!strncmp(token, "UNIQUE", 4)) {

0 commit comments

Comments
 (0)