OSDN Git Service

Represent type-specific length coercion functions as pg_cast entries,
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 16 Jun 2004 01:27:00 +0000 (01:27 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 16 Jun 2004 01:27:00 +0000 (01:27 +0000)
commitd70a42e6424e1531355ce9d1d1aa59e329b3c0e6
treea562d86d0f5128916ecfd213906996a12940335e
parent8e7349b73806a993f72976bbf7dfaa9b1cf270b8
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.
23 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/datatype.sgml
doc/src/sgml/func.sgml
doc/src/sgml/ref/create_cast.sgml
doc/src/sgml/syntax.sgml
src/backend/commands/copy.c
src/backend/commands/functioncmds.c
src/backend/optimizer/prep/preptlist.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/rewrite/rewriteHandler.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/varbit.c
src/include/catalog/catversion.h
src/include/catalog/pg_cast.h
src/include/catalog/pg_proc.h
src/include/parser/parse_coerce.h
src/include/utils/array.h
src/test/regress/expected/opr_sanity.out
src/test/regress/sql/opr_sanity.sql