summaryrefslogtreecommitdiff
path: root/src/backend/catalog/dependency.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-12-28 01:30:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-12-28 01:30:02 +0000
commit6e07709760a29d8dbfb93b9846c905bd40689082 (patch)
tree9bf0084587d7e313ba087ce53c24bc748c63a456 /src/backend/catalog/dependency.c
parenta37422e042a6114ab0e513f50dac4a47fab22313 (diff)
downloadpostgresql-6e07709760a29d8dbfb93b9846c905bd40689082.tar.gz
Implement SQL-compliant treatment of row comparisons for < <= > >= cases
(previously we only did = and <> correctly). Also, allow row comparisons with any operators that are in btree opclasses, not only those with these specific names. This gets rid of a whole lot of indefensible assumptions about the behavior of particular operators based on their names ... though it's still true that IN and NOT IN expand to "= ANY". The patch adds a RowCompareExpr expression node type, and makes some changes in the representation of ANY/ALL/ROWCOMPARE SubLinks so that they can share code with RowCompareExpr. I have not yet done anything about making RowCompareExpr an indexable operator, but will look at that soon. initdb forced due to changes in stored rules.
Diffstat (limited to 'src/backend/catalog/dependency.c')
-rw-r--r--src/backend/catalog/dependency.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index 245b8965f8..fb0dce5d23 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.48 2005/11/22 18:17:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.49 2005/12/28 01:29:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1129,23 +1129,28 @@ find_expr_references_walker(Node *node,
&context->addrs);
/* fall through to examine arguments */
}
- if (IsA(node, SubLink))
+ if (is_subplan(node))
{
- SubLink *sublink = (SubLink *) node;
- ListCell *opid;
+ /* Extra work needed here if we ever need this case */
+ elog(ERROR, "already-planned subqueries not supported");
+ }
+ if (IsA(node, RowCompareExpr))
+ {
+ RowCompareExpr *rcexpr = (RowCompareExpr *) node;
+ ListCell *l;
- foreach(opid, sublink->operOids)
+ foreach(l, rcexpr->opnos)
{
- add_object_address(OCLASS_OPERATOR, lfirst_oid(opid), 0,
+ add_object_address(OCLASS_OPERATOR, lfirst_oid(l), 0,
+ &context->addrs);
+ }
+ foreach(l, rcexpr->opclasses)
+ {
+ add_object_address(OCLASS_OPCLASS, lfirst_oid(l), 0,
&context->addrs);
}
/* fall through to examine arguments */
}
- if (is_subplan(node))
- {
- /* Extra work needed here if we ever need this case */
- elog(ERROR, "already-planned subqueries not supported");
- }
if (IsA(node, Query))
{
/* Recurse into RTE subquery or not-yet-planned sublink subquery */