diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-16 01:27:00 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-16 01:27:00 +0000 |
commit | d70a42e6424e1531355ce9d1d1aa59e329b3c0e6 (patch) | |
tree | a562d86d0f5128916ecfd213906996a12940335e /src/backend/parser/parse_clause.c | |
parent | 8e7349b73806a993f72976bbf7dfaa9b1cf270b8 (diff) | |
download | postgresql-d70a42e6424e1531355ce9d1d1aa59e329b3c0e6.tar.gz postgresql-d70a42e6424e1531355ce9d1d1aa59e329b3c0e6.zip |
Represent type-specific length coercion functions as pg_cast entries,
eliminating the former hard-wired convention about their names. Allow
pg_cast entries to represent both type coercion and length coercion in
a single step --- this is represented by a function that takes an
extra typmod argument, just like a length coercion function. This
nicely merges the type and length coercion mechanisms into something
at least a little cleaner than we had before. Make use of the single-
coercion-step behavior to fix integer-to-bit coercion so that coercing
to bit(n) yields the rightmost n bits of the integer instead of the
leftmost n bits. This should fix recurrent complaints about the odd
behavior of this coercion. Clean up the documentation of the bit string
functions, and try to put it where people might actually find it.
Also, get rid of the unreliable heuristics in ruleutils.c about whether
to display nested coercion steps; instead require parse_coerce.c to
label them properly in the first place.
Diffstat (limited to 'src/backend/parser/parse_clause.c')
-rw-r--r-- | src/backend/parser/parse_clause.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index a2cd7dccc15..b3a6b67f5c3 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.132 2004/06/09 19:08:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.133 2004/06/16 01:26:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -915,11 +915,11 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype, * Insert coercion functions if needed. Note that a difference in * typmod can only happen if input has typmod but outcoltypmod is -1. * In that case we insert a RelabelType to clearly mark that result's - * typmod is not same as input. + * typmod is not same as input. We never need coerce_type_typmod. */ if (l_colvar->vartype != outcoltype) l_node = coerce_type(pstate, (Node *) l_colvar, l_colvar->vartype, - outcoltype, + outcoltype, outcoltypmod, COERCION_IMPLICIT, COERCE_IMPLICIT_CAST); else if (l_colvar->vartypmod != outcoltypmod) l_node = (Node *) makeRelabelType((Expr *) l_colvar, @@ -930,7 +930,7 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype, if (r_colvar->vartype != outcoltype) r_node = coerce_type(pstate, (Node *) r_colvar, r_colvar->vartype, - outcoltype, + outcoltype, outcoltypmod, COERCION_IMPLICIT, COERCE_IMPLICIT_CAST); else if (r_colvar->vartypmod != outcoltypmod) r_node = (Node *) makeRelabelType((Expr *) r_colvar, @@ -1276,7 +1276,7 @@ transformGroupClause(ParseState *pstate, List *grouplist, if (restype == UNKNOWNOID) { tle->expr = (Expr *) coerce_type(pstate, (Node *) tle->expr, - restype, TEXTOID, + restype, TEXTOID, -1, COERCION_IMPLICIT, COERCE_IMPLICIT_CAST); restype = tle->resdom->restype = TEXTOID; @@ -1528,7 +1528,7 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle, if (restype == UNKNOWNOID && resolveUnknown) { tle->expr = (Expr *) coerce_type(pstate, (Node *) tle->expr, - restype, TEXTOID, + restype, TEXTOID, -1, COERCION_IMPLICIT, COERCE_IMPLICIT_CAST); restype = tle->resdom->restype = TEXTOID; |