Skip site navigation (1) Skip section navigation (2)

pgsql: Fix coerce_to_target_type for coerce_type's klugy handling ofCO

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix coerce_to_target_type for coerce_type's klugy handling ofCO
Date: 2012-01-02 19:44:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
Fix coerce_to_target_type for coerce_type's klugy handling of COLLATE.

Because coerce_type recurses into the argument of a CollateExpr,
coerce_to_target_type's longstanding code for detecting whether coerce_type
had actually done anything (to wit, returned a different node than it
passed in) was broken in 9.1.  This resulted in unexpected failures in
hide_coercion_node; which was not the latter's fault, since it's critical
that we never call it on anything that wasn't inserted by coerce_type.
(Else we might decide to "hide" a user-written function call.)

Fix by removing and replacing the CollateExpr in coerce_to_target_type
itself.  This is all pretty ugly but I don't immediately see a way to make
it nicer.

Per report from Jean-Yves F. Barbier.



Modified Files
src/backend/parser/parse_coerce.c     |   28 +++++++++++++++++++++++++++-
src/test/regress/expected/collate.out |    3 +++
src/test/regress/sql/collate.sql      |    5 +++++
3 files changed, 35 insertions(+), 1 deletions(-)

pgsql-committers by date

Next:From: Peter EisentrautDate: 2012-01-02 20:12:43
Subject: pgsql: pg_regress: Replace exit_nicely() with exit() plus atexit()hook
Previous:From: Bruce MomjianDate: 2012-01-02 13:49:14
Subject: pgsql: Add comment about skipping binary files for copyright changes.

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group