Bug #444: create table xy as select a, b from t_a left join t_b on cond fails in PL/pgSQL

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #444: create table xy as select a, b from t_a left join t_b on cond fails in PL/pgSQL
Date: 2001-09-09 12:50:50
Message-ID: 200109091250.f89CooI17652@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Marc Balmer (marc(at)msys(dot)ch) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
create table xy as select a,b from t_a left join t_b on cond fails in PL/pgSQL

Long Description
A SQL statement "create table t2 as select a,b from t_a left join t_b on <condition>;" works as expected when entered in psql but fails if it is part of PL/pgSQL function.

If executed in a PL/pgSQL function, the result table t2 will be created with columns a and b but only the values of a are inserted, column b remains empty in all rows.

Sample Code
-- works in psql, fails in PL/pgsql

create table datum (datum date);
create table termin (datum date, titel varchar(64), i integer);

create table t2 as select datum.datum,termin.titel from datum
left join termin on datum.datum >= termin.datum
and ((datum.datum - termin.datum) % i = 0)
and (enddatum >= datum.datum or enddatum = null);

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message John Summerfield 2001-09-09 13:01:36 ecpg incompatibility with DB2
Previous Message Robert B. Easter 2001-09-09 07:21:17 Re: [PATCHES] JDBC patch (attempt#2) for util.Serialize and jdbc2.PreparedStatement