aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_func.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2000-01-24 19:34:19 +0000
committerPeter Eisentraut <peter_e@gmx.net>2000-01-24 19:34:19 +0000
commitbdb41ad0e74729efda889b6c6fda313aaeaa9960 (patch)
tree1926cc44a9cb9fca02dc60aafec12bf82a70a416 /src/backend/parser/parse_func.c
parent0dbffa704ab3235431b4caef675d9179109d4a0c (diff)
downloadpostgresql-bdb41ad0e74729efda889b6c6fda313aaeaa9960.tar.gz
postgresql-bdb41ad0e74729efda889b6c6fda313aaeaa9960.zip
Made abstime/reltime use int4 instead of time_t (TODO item)
Made type equivalency apply to aggregates (TODO item) Fixed parsing bug in psql Reverted some stupid options changes I made to pg_dump
Diffstat (limited to 'src/backend/parser/parse_func.c')
-rw-r--r--src/backend/parser/parse_func.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 1f63f6bc669..610fceac639 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.66 2000/01/10 17:14:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.67 2000/01/24 19:34:14 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -176,8 +176,26 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
current_category;
/*
- * Look for candidates which allow coersion and have a preferred type.
- * Keep all candidates if none match.
+ * First look for exact matches or binary compatible matches.
+ * (Of course exact matches shouldn't even get here, but anyway.)
+ */
+ for (current_candidate = candidates;
+ current_candidate != NULL;
+ current_candidate = current_candidate->next)
+ {
+ current_typeid = current_candidate->args[0];
+
+ if (current_typeid == typeid
+ || IS_BINARY_COMPATIBLE(current_typeid, typeid))
+ {
+ /* we're home free */
+ return current_typeid;
+ }
+ }
+
+/*
+ * If no luck that way, look for candidates which allow coersion
+ * and have a preferred type. Keep all candidates if none match.
*/
category = TypeCategory(typeid);
ncandidates = 0;
@@ -189,7 +207,7 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
current_typeid = current_candidate->args[0];
current_category = TypeCategory(current_typeid);
- if ((current_category == category)
+ if (current_category == category
&& IsPreferredType(current_category, current_typeid)
&& can_coerce_type(1, &typeid, &current_typeid))
{