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

From pgsql-bugs@postgresql.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
Msg-id 200109091250.f89CooI17652@hub.org
Whole thread Raw
List pgsql-bugs
Marc Balmer (marc@msys.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
inpsql 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
areinserted, 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

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #443: Problem with time functions.
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #445: SQLDescribeCol() returns "wrong" info