Thread: pgsql: Prevent invoking I/O conversion casts via functional/attribute n

pgsql: Prevent invoking I/O conversion casts via functional/attribute n

From
Tom Lane
Date:
Prevent invoking I/O conversion casts via functional/attribute notation.

PG 8.4 added a built-in feature for casting pretty much any data type to
string types (text, varchar, etc).  We allowed this to work in any of the
historically-allowed syntaxes: CAST(x AS text), x::text, text(x), or
x.text.  However, multiple complaints have shown that it's too easy to
invoke such casts unintentionally in the latter two styles, particularly
field selection.  To cure the problem with the narrowest possible change
of behavior, disallow use of I/O conversion casts from composite types to
string types via functional/attribute syntax.  The new functionality is
still available via cast syntax.

In passing, document the equivalence of functional and attribute syntax
in a more visible place.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=543d22fc7423747afd59fe7214f2ddf6259efc62

Modified Files
--------------
doc/src/sgml/ref/create_cast.sgml      |   27 ++++++++++++++----
doc/src/sgml/syntax.sgml               |   13 +++++++++
doc/src/sgml/xfunc.sgml                |    8 +++++-
src/backend/parser/parse_func.c        |   28 ++++++++++++++++---
src/test/regress/expected/rowtypes.out |   46 ++++++++++++++++++++++++++++++++
src/test/regress/sql/rowtypes.sql      |   15 ++++++++++
6 files changed, 126 insertions(+), 11 deletions(-)