Re: [PORTS] Port Bug Report: Command "CREATE TABLE AS with SELECT ... UNION" don't work

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Angelo CONFLITTI <mvca(at)yahoo(dot)com>
Cc: pgsql-ports(at)postgreSQL(dot)org
Subject: Re: [PORTS] Port Bug Report: Command "CREATE TABLE AS with SELECT ... UNION" don't work
Date: 1999-07-09 16:42:52
Message-ID: 199907091642.MAA01053@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports


Added to TODO:

* CREATE TABLE x AS SELECT 1 UNION SELECT 2 fails

> Problem Description:
> --------------------
> Excuse for my english.
> Table description (name=PARTNERS):
> id char(6),
> cogn char(20),
> ids1 char(6),
> ids2 char(6),
> importo int8
>
> The query:
> CREATE TABLE pippo AS
> SELECT a.id,a.cogn,b.id AS id1,b.importo AS imp1,null AS id2,b.importo AS imp2
> FROM partners a, parteners b
> WHERE a.id=b.ids1
> UNION
> SELECT a.id,a.cogn,null AS id1,null AS imp1,b.id AS id2,importo AS imp2
> FROM partners a, partners b
> WHERE a.id=b.ids2
>
> The error message of Postgre is "ERROR: parser: parse error at or near "union".
> With the PostgreSQL 6.4.2 it's work.
> In PostgreSQL 6.5, if I use the command SELECT ... INTO TABLE, it's work.
>
> A little difference between Postgre6.5 and Postgre6.4.2: if I have, in a table, a unknown field type (this is generated from a "SELECT ... null AS imp2 ... INTO TABLE ..." or "CREATE TABLE AS...")
> and run a SELECT SUM(...) of the unknown field the PostgreSQL 6.5 answer: "ERROR: Aggregate type mismatch sum() works on numeric, not on unknown";
> with PostgreSQL 6.4.2 the SUM() function of the unknown field work.
>
> Thank you for your precious PostgreSQL!! :-))
> It's a usefull program. I hope to repay your enterprise.
>
> Enjoy.
>
>
> --------------------------------------------------------------------------
>
> Test Case:
> ----------
>
>
> --------------------------------------------------------------------------
>
> Solution:
> ---------
>
>
> --------------------------------------------------------------------------
>
>
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-ports by date

  From Date Subject
Next Message Bruce Momjian 1999-07-09 16:49:39 Re: [PORTS] Port Bug Report: ERROR:RestrictionClauseSelectivity: bad value 164739.656250
Previous Message MESZAROS Attila 1999-07-09 14:32:50 Above 2G on a 32 bit architecture