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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Prevent invoking I/O conversion casts via functional/attribute n
Date: 2010-11-07 18:03:38
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

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.



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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message User Andrewd 2010-11-07 20:50:56 pgbuildfarm - client-code: Support buildfarm client maintained git
Previous Message Tom Lane 2010-11-07 03:00:11 pgsql: Add support for detecting register-stack overrun on IA64.