aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-12-03 17:45:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-12-03 17:45:10 +0000
commit7f8f7665fca489e171d9cce7e8c36a034c3da086 (patch)
treedab1cfd05ceb9254f4398c7e74a4266d0cf2a6a1 /src/backend/utils/cache/lsyscache.c
parent32580efafbbf9f72f4fd691c01838ce5a7303acb (diff)
downloadpostgresql-7f8f7665fca489e171d9cce7e8c36a034c3da086.tar.gz
postgresql-7f8f7665fca489e171d9cce7e8c36a034c3da086.zip
Planner failed to be smart about binary-compatible expressions in pathkeys
and hash bucket-size estimation. Issue has been there awhile but is more critical in 7.4 because it affects varchar columns. Per report from Greg Stark.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 6d4053f608c..237cf97e6c7 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.111 2003/11/29 19:52:00 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.112 2003/12/03 17:45:09 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -466,6 +466,29 @@ get_opname(Oid opno)
}
/*
+ * op_input_types
+ *
+ * Returns the left and right input datatypes for an operator
+ * (InvalidOid if not relevant).
+ */
+void
+op_input_types(Oid opno, Oid *lefttype, Oid *righttype)
+{
+ HeapTuple tp;
+ Form_pg_operator optup;
+
+ tp = SearchSysCache(OPEROID,
+ ObjectIdGetDatum(opno),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(tp)) /* shouldn't happen */
+ elog(ERROR, "cache lookup failed for operator %u", opno);
+ optup = (Form_pg_operator) GETSTRUCT(tp);
+ *lefttype = optup->oprleft;
+ *righttype = optup->oprright;
+ ReleaseSysCache(tp);
+}
+
+/*
* op_mergejoinable
*
* Returns the left and right sort operators corresponding to a