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

pgsql: Fix plpgsql's exec_eval_expr() to ensure it returns a sane type

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix plpgsql's exec_eval_expr() to ensure it returns a sane type
Date: 2010-04-14 23:52:16
Message-ID: 20100414235216.D5F517541D0@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Fix plpgsql's exec_eval_expr() to ensure it returns a sane type OID
even when the expression is a query that returns no rows.

So far as I can tell, the only caller that actually fails when a garbage
OID is returned is exec_stmt_case(), which is new in 8.4 --- in all other
cases, we might make a useless trip through casting logic, but we won't
fail since the isnull flag will be set.  Hence, backpatch only to 8.4,
just in case there are apps out there that aren't expecting an error to
be thrown if the query returns more or less than one column.  (Which seems
unlikely, since the error would be thrown if the query ever did return a
row; but it's possible there's some never-exercised code out there.)

Per report from Mario Splivalo.

Tags:
----
REL8_4_STABLE

Modified Files:
--------------
    pgsql/src/pl/plpgsql/src:
        pl_exec.c (r1.244.2.3 -> r1.244.2.4)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_exec.c?r1=1.244.2.3&r2=1.244.2.4)

pgsql-committers by date

Next:From: Bruce MomjianDate: 2010-04-15 03:05:59
Subject: pgsql: Doc change: effect -> affect, per Robert Haas
Previous:From: Tom LaneDate: 2010-04-14 23:52:10
Subject: pgsql: Fix plpgsql's exec_eval_expr() to ensure it returns a sane type

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