pgsql: Need to special-case RECORD as well as UNKNOWN in plpgsql's cast

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Need to special-case RECORD as well as UNKNOWN in plpgsql's cast
Date: 2015-03-05 00:11:04
Message-ID: E1YTJNY-00029V-Nl@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Need to special-case RECORD as well as UNKNOWN in plpgsql's casting logic.

This is because can_coerce_type thinks that RECORD can be cast to any
composite type, but coerce_record_to_complex only works for inputs that are
RowExprs or whole-row Vars, so we get a hard failure on a CaseTestExpr.

Perhaps these corner cases ought to be fixed so that coerce_to_target_type
actually returns NULL as per its specification, rather than failing ...
but for the moment an extra check here is the path of least resistance.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/45f2c2fc4e4adcf75cd689e18dab77ebe622fc2e

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-03-05 01:23:19 pgsql: Change plpgsql's cast cache to consider source typmod as signifi
Previous Message Tom Lane 2015-03-04 16:04:38 pgsql: Use standard casting mechanism to convert types in plpgsql, when