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
a66e2c88
Commit
a66e2c88
authored
Nov 26, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach push_nots() how to negate a ScalarArrayOpExpr. In passing, save
a palloc or two in the OpExpr case.
parent
4c4eb571
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
6 deletions
+35
-6
src/backend/optimizer/prep/prepqual.c
src/backend/optimizer/prep/prepqual.c
+35
-6
No files found.
src/backend/optimizer/prep/prepqual.c
View file @
a66e2c88
...
...
@@ -25,7 +25,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.5
2 2005/11/22 18:17:14 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepqual.c,v 1.5
3 2005/11/26 18:07:40 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -212,11 +212,40 @@ push_nots(Expr *qual)
Oid
negator
=
get_negator
(
opexpr
->
opno
);
if
(
negator
)
return
make_opclause
(
negator
,
opexpr
->
opresulttype
,
opexpr
->
opretset
,
(
Expr
*
)
get_leftop
(
qual
),
(
Expr
*
)
get_rightop
(
qual
));
{
OpExpr
*
newopexpr
=
makeNode
(
OpExpr
);
newopexpr
->
opno
=
negator
;
newopexpr
->
opfuncid
=
InvalidOid
;
newopexpr
->
opresulttype
=
opexpr
->
opresulttype
;
newopexpr
->
opretset
=
opexpr
->
opretset
;
newopexpr
->
args
=
opexpr
->
args
;
return
(
Expr
*
)
newopexpr
;
}
else
return
make_notclause
(
qual
);
}
else
if
(
qual
&&
IsA
(
qual
,
ScalarArrayOpExpr
))
{
/*
* Negate a ScalarArrayOpExpr if there is a negator for its operator;
* for example x = ANY (list) becomes x <> ALL (list).
* Otherwise, retain the clause as it is (the NOT can't be pushed down
* any farther).
*/
ScalarArrayOpExpr
*
saopexpr
=
(
ScalarArrayOpExpr
*
)
qual
;
Oid
negator
=
get_negator
(
saopexpr
->
opno
);
if
(
negator
)
{
ScalarArrayOpExpr
*
newopexpr
=
makeNode
(
ScalarArrayOpExpr
);
newopexpr
->
opno
=
negator
;
newopexpr
->
opfuncid
=
InvalidOid
;
newopexpr
->
useOr
=
!
saopexpr
->
useOr
;
newopexpr
->
args
=
saopexpr
->
args
;
return
(
Expr
*
)
newopexpr
;
}
else
return
make_notclause
(
qual
);
}
...
...
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