Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
1401f63d
Commit
1401f63d
authored
Jan 25, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agg/Aggreg cleanup and datetime.sql patch.
parent
247b3f90
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
122 additions
and
126 deletions
+122
-126
src/backend/executor/execQual.c
src/backend/executor/execQual.c
+5
-5
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAgg.c
+67
-74
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+2
-2
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/planner.c
+3
-3
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/setrefs.c
+3
-3
src/backend/rewrite/locks.c
src/backend/rewrite/locks.c
+3
-3
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteHandler.c
+19
-19
src/backend/rewrite/rewriteManip.c
src/backend/rewrite/rewriteManip.c
+9
-9
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/ruleutils.c
+6
-6
src/include/optimizer/planmain.h
src/include/optimizer/planmain.h
+2
-2
src/test/regress/sql/datetime.sql
src/test/regress/sql/datetime.sql
+3
-0
No files found.
src/backend/executor/execQual.c
View file @
1401f63d
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.4
0 1999/01/24 00:28:18
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.4
1 1999/01/25 18:02:13
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -67,7 +67,7 @@ bool execConstByVal;
int
execConstLen
;
/* static functions decls */
static
Datum
ExecEvalAggref
(
Aggref
*
agg
,
ExprContext
*
econtext
,
bool
*
isNull
);
static
Datum
ExecEvalAggref
(
Aggref
*
agg
ref
,
ExprContext
*
econtext
,
bool
*
isNull
);
static
Datum
ExecEvalArrayRef
(
ArrayRef
*
arrayRef
,
ExprContext
*
econtext
,
bool
*
isNull
,
bool
*
isDone
);
static
Datum
ExecEvalAnd
(
Expr
*
andExpr
,
ExprContext
*
econtext
,
bool
*
isNull
);
...
...
@@ -192,10 +192,10 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
* ----------------------------------------------------------------
*/
static
Datum
ExecEvalAggref
(
Aggref
*
agg
,
ExprContext
*
econtext
,
bool
*
isNull
)
ExecEvalAggref
(
Aggref
*
agg
ref
,
ExprContext
*
econtext
,
bool
*
isNull
)
{
*
isNull
=
econtext
->
ecxt_nulls
[
agg
->
aggno
];
return
econtext
->
ecxt_values
[
agg
->
aggno
];
*
isNull
=
econtext
->
ecxt_nulls
[
agg
ref
->
aggno
];
return
econtext
->
ecxt_values
[
agg
ref
->
aggno
];
}
/* ----------------------------------------------------------------
...
...
src/backend/executor/nodeAgg.c
View file @
1401f63d
This diff is collapsed.
Click to expand it.
src/backend/nodes/copyfuncs.c
View file @
1401f63d
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.5
4 1999/01/24 00:28:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.5
5 1999/01/25 18:02:14
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -506,7 +506,7 @@ _copyAgg(Agg *from)
CopyPlanFields
((
Plan
*
)
from
,
(
Plan
*
)
newnode
);
newnode
->
aggs
=
s
et_agg_tlist_references
(
newnode
);
newnode
->
aggs
=
g
et_agg_tlist_references
(
newnode
);
Node_Copy
(
from
,
newnode
,
aggstate
);
return
newnode
;
...
...
src/backend/optimizer/plan/planner.c
View file @
1401f63d
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.3
7 1999/01/25 12:01:04 vadim
Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.3
8 1999/01/25 18:02:15 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -249,7 +249,7 @@ union_planner(Query *parse)
{
int
old_length
=
0
,
new_length
=
0
;
/* Create the A
GG
node but use 'tlist' not 'new_tlist' as target list because we
/* Create the A
gg
node but use 'tlist' not 'new_tlist' as target list because we
* don't want the additional attributes (only used for the havingQual, see above)
* to show up in the result */
result_plan
=
(
Plan
*
)
make_agg
(
tlist
,
result_plan
);
...
...
@@ -259,7 +259,7 @@ union_planner(Query *parse)
* the result tuple of the subplans.
*/
((
Agg
*
)
result_plan
)
->
aggs
=
s
et_agg_tlist_references
((
Agg
*
)
result_plan
);
g
et_agg_tlist_references
((
Agg
*
)
result_plan
);
/***S*H***/
...
...
src/backend/optimizer/plan/setrefs.c
View file @
1401f63d
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.3
2 1999/01/24 00:28:20
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.3
3 1999/01/25 18:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -700,7 +700,7 @@ OperandIsInner(Node *opnd, int inner_relid)
/*---------------------------------------------------------
*
*
s
et_agg_tlist_references -
*
g
et_agg_tlist_references -
* changes the target list of an Agg node so that it points to
* the tuples returned by its left tree subplan.
*
...
...
@@ -708,7 +708,7 @@ OperandIsInner(Node *opnd, int inner_relid)
*
*/
List
*
s
et_agg_tlist_references
(
Agg
*
aggNode
)
g
et_agg_tlist_references
(
Agg
*
aggNode
)
{
List
*
aggTargetList
;
List
*
subplanTargetList
;
...
...
src/backend/rewrite/locks.c
View file @
1401f63d
...
...
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.1
5 1999/01/24 00:28:30
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.1
6 1999/01/25 18:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -68,9 +68,9 @@ nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
break
;
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
return
nodeThisLockWasTriggered
(
agg
->
target
,
varno
,
attnum
,
return
nodeThisLockWasTriggered
(
agg
ref
->
target
,
varno
,
attnum
,
sublevels_up
);
}
break
;
...
...
src/backend/rewrite/rewriteHandler.c
View file @
1401f63d
...
...
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.3
1 1999/01/25 12:01:14 vadim
Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.3
2 1999/01/25 18:02:20 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -162,10 +162,10 @@ rangeTableEntry_used(Node *node, int rt_index, int sublevels_up)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
return
rangeTableEntry_used
(
(
Node
*
)(
agg
->
target
),
(
Node
*
)(
agg
ref
->
target
),
rt_index
,
sublevels_up
);
}
...
...
@@ -398,10 +398,10 @@ attribute_used(Node *node, int rt_index, int attno, int sublevels_up)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
return
attribute_used
(
(
Node
*
)(
agg
->
target
),
(
Node
*
)(
agg
ref
->
target
),
rt_index
,
attno
,
sublevels_up
);
...
...
@@ -607,10 +607,10 @@ modifyAggrefUplevel(Node *node)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
modifyAggrefUplevel
(
(
Node
*
)(
agg
->
target
));
(
Node
*
)(
agg
ref
->
target
));
}
break
;
...
...
@@ -743,10 +743,10 @@ modifyAggrefChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
modifyAggrefChangeVarnodes
(
(
Node
**
)(
&
(
agg
->
target
)),
(
Node
**
)(
&
(
agg
ref
->
target
)),
rt_index
,
new_index
,
sublevels_up
);
...
...
@@ -933,12 +933,12 @@ modifyAggrefDropQual(Node **nodePtr, Node *orignode, Expr *expr)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
oagg
=
(
Aggref
*
)
orignode
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
Aggref
*
oagg
ref
=
(
Aggref
*
)
orignode
;
modifyAggrefDropQual
(
(
Node
**
)(
&
(
agg
->
target
)),
(
Node
*
)(
oagg
->
target
),
(
Node
**
)(
&
(
agg
ref
->
target
)),
(
Node
*
)(
oagg
ref
->
target
),
expr
);
}
break
;
...
...
@@ -1378,10 +1378,10 @@ apply_RIR_adjust_sublevel(Node *node, int sublevels_up)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
apply_RIR_adjust_sublevel
(
(
Node
*
)(
agg
->
target
),
(
Node
*
)(
agg
ref
->
target
),
sublevels_up
);
}
break
;
...
...
@@ -1527,10 +1527,10 @@ apply_RIR_view(Node **nodePtr, int rt_index, RangeTblEntry *rte, List *tlist, in
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
apply_RIR_view
(
(
Node
**
)(
&
(
agg
->
target
)),
(
Node
**
)(
&
(
agg
ref
->
target
)),
rt_index
,
rte
,
tlist
,
...
...
@@ -1928,10 +1928,10 @@ fireRIRonSubselect(Node *node)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
fireRIRonSubselect
(
(
Node
*
)(
agg
->
target
));
(
Node
*
)(
agg
ref
->
target
));
}
break
;
...
...
src/backend/rewrite/rewriteManip.c
View file @
1401f63d
...
...
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.2
5 1999/01/24 00:28:31
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.2
6 1999/01/25 18:02:22
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -55,10 +55,10 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
OffsetVarNodes
(
(
Node
*
)(
agg
->
target
),
(
Node
*
)(
agg
ref
->
target
),
offset
,
sublevels_up
);
}
...
...
@@ -273,10 +273,10 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
ChangeVarNodes
(
(
Node
*
)(
agg
->
target
),
(
Node
*
)(
agg
ref
->
target
),
rt_index
,
new_index
,
sublevels_up
);
...
...
@@ -748,9 +748,9 @@ nodeHandleRIRAttributeRule(Node **nodePtr,
break
;
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
nodeHandleRIRAttributeRule
(
&
agg
->
target
,
rtable
,
targetlist
,
nodeHandleRIRAttributeRule
(
&
agg
ref
->
target
,
rtable
,
targetlist
,
rt_index
,
attr_num
,
modified
,
badsql
,
sublevels_up
);
}
...
...
@@ -913,9 +913,9 @@ nodeHandleViewRule(Node **nodePtr,
break
;
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
nodeHandleViewRule
(
&
(
agg
->
target
),
rtable
,
targetlist
,
nodeHandleViewRule
(
&
(
agg
ref
->
target
),
rtable
,
targetlist
,
rt_index
,
modified
,
sublevels_up
);
}
break
;
...
...
src/backend/utils/adt/ruleutils.c
View file @
1401f63d
...
...
@@ -3,7 +3,7 @@
* out of it's tuple
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.
7 1999/01/24 00:28:32
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.
8 1999/01/25 18:02:23
momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
...
...
@@ -1247,13 +1247,13 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
strcat
(
buf
,
"
\"
"
);
strcat
(
buf
,
agg
->
aggname
);
strcat
(
buf
,
agg
ref
->
aggname
);
strcat
(
buf
,
"
\"
("
);
strcat
(
buf
,
get_rule_expr
(
qh
,
rt_index
,
(
Node
*
)
(
agg
->
target
),
varprefix
));
(
Node
*
)
(
agg
ref
->
target
),
varprefix
));
strcat
(
buf
,
")"
);
return
pstrdup
(
buf
);
}
...
...
@@ -1729,10 +1729,10 @@ check_if_rte_used(int rt_index, Node *node, int sup)
case
T_Aggref
:
{
Aggref
*
agg
=
(
Aggref
*
)
node
;
Aggref
*
agg
ref
=
(
Aggref
*
)
node
;
return
check_if_rte_used
(
rt_index
,
(
Node
*
)
(
agg
->
target
),
sup
);
(
Node
*
)
(
agg
ref
->
target
),
sup
);
}
break
;
...
...
src/include/optimizer/planmain.h
View file @
1401f63d
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: planmain.h,v 1.1
7 1998/10/08 18:30:34
momjian Exp $
* $Id: planmain.h,v 1.1
8 1999/01/25 18:02:28
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -54,7 +54,7 @@ extern List *join_references(List *clauses, List *outer_tlist,
List
*
inner_tlist
);
extern
List
*
index_outerjoin_references
(
List
*
inner_indxqual
,
List
*
outer_tlist
,
Index
inner_relid
);
extern
List
*
s
et_agg_tlist_references
(
Agg
*
aggNode
);
extern
List
*
g
et_agg_tlist_references
(
Agg
*
aggNode
);
extern
void
set_agg_agglist_references
(
Agg
*
aggNode
);
extern
void
del_agg_tlist_references
(
List
*
tlist
);
extern
List
*
check_having_qual_for_aggs
(
Node
*
clause
,
...
...
src/test/regress/sql/datetime.sql
View file @
1401f63d
...
...
@@ -10,6 +10,9 @@ SELECT ('tomorrow'::datetime = ('yesterday'::datetime + '2 days'::timespan)) as
SELECT
(
'current'
::
datetime
=
'now'
::
datetime
)
as
"True"
;
SELECT
(
'now'
::
datetime
-
'current'
::
datetime
)
AS
"ZeroSecs"
;
SET
DateStyle
=
'Postgres,noneuropean'
;
SELECT
datetime
(
'1994-01-01'
,
'11:00'
)
AS
"Jan_01_1994_11am"
;
CREATE
TABLE
DATETIME_TBL
(
d1
datetime
);
INSERT
INTO
DATETIME_TBL
VALUES
(
'current'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment