Thread: pgsql-server: Represent type-specific length coercion functions as

pgsql-server: Represent type-specific length coercion functions as

From
tgl@svr1.postgresql.org (Tom Lane)
Date:
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql-server/doc/src/sgml:
        catalogs.sgml (r2.86 -> r2.87)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/catalogs.sgml.diff?r1=2.86&r2=2.87)
        datatype.sgml (r1.145 -> r1.146)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/datatype.sgml.diff?r1=1.145&r2=1.146)
        func.sgml (r1.208 -> r1.209)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/func.sgml.diff?r1=1.208&r2=1.209)
        syntax.sgml (r1.93 -> r1.94)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/syntax.sgml.diff?r1=1.93&r2=1.94)
    pgsql-server/doc/src/sgml/ref:
        create_cast.sgml (r1.16 -> r1.17)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/ref/create_cast.sgml.diff?r1=1.16&r2=1.17)
    pgsql-server/src/backend/commands:
        copy.c (r1.226 -> r1.227)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/copy.c.diff?r1=1.226&r2=1.227)
        functioncmds.c (r1.47 -> r1.48)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/functioncmds.c.diff?r1=1.47&r2=1.48)
    pgsql-server/src/backend/optimizer/prep:
        preptlist.c (r1.68 -> r1.69)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/optimizer/prep/preptlist.c.diff?r1=1.68&r2=1.69)
    pgsql-server/src/backend/parser:
        parse_clause.c (r1.132 -> r1.133)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/parser/parse_clause.c.diff?r1=1.132&r2=1.133)
        parse_coerce.c (r2.118 -> r2.119)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/parser/parse_coerce.c.diff?r1=2.118&r2=2.119)
        parse_expr.c (r1.173 -> r1.174)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/parser/parse_expr.c.diff?r1=1.173&r2=1.174)
        parse_func.c (r1.170 -> r1.171)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/parser/parse_func.c.diff?r1=1.170&r2=1.171)
    pgsql-server/src/backend/rewrite:
        rewriteHandler.c (r1.139 -> r1.140)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/rewrite/rewriteHandler.c.diff?r1=1.139&r2=1.140)
    pgsql-server/src/backend/utils/adt:
        arrayfuncs.c (r1.104 -> r1.105)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/adt/arrayfuncs.c.diff?r1=1.104&r2=1.105)
        ruleutils.c (r1.171 -> r1.172)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/adt/ruleutils.c.diff?r1=1.171&r2=1.172)
        varbit.c (r1.38 -> r1.39)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/adt/varbit.c.diff?r1=1.38&r2=1.39)
    pgsql-server/src/include/catalog:
        catversion.h (r1.235 -> r1.236)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/catalog/catversion.h.diff?r1=1.235&r2=1.236)
        pg_cast.h (r1.11 -> r1.12)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/catalog/pg_cast.h.diff?r1=1.11&r2=1.12)
        pg_proc.h (r1.337 -> r1.338)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/catalog/pg_proc.h.diff?r1=1.337&r2=1.338)
    pgsql-server/src/include/parser:
        parse_coerce.h (r1.56 -> r1.57)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/parser/parse_coerce.h.diff?r1=1.56&r2=1.57)
    pgsql-server/src/include/utils:
        array.h (r1.47 -> r1.48)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/utils/array.h.diff?r1=1.47&r2=1.48)
    pgsql-server/src/test/regress/expected:
        opr_sanity.out (r1.54 -> r1.55)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/test/regress/expected/opr_sanity.out.diff?r1=1.54&r2=1.55)
    pgsql-server/src/test/regress/sql:
        opr_sanity.sql (r1.43 -> r1.44)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/test/regress/sql/opr_sanity.sql.diff?r1=1.43&r2=1.44)