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

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 (view raw or flat)
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


pgsql-bugs by date

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

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