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

From Bruce Momjian
Subject Re: [PORTS] Port Bug Report: Command "CREATE TABLE AS with SELECT ... UNION" don't work
Date
Msg-id 199907091642.MAA01053@candle.pha.pa.us
Whole thread Raw
In response to Port Bug Report: Command "CREATE TABLE AS with SELECT ... UNION" don't work  (Unprivileged user <nobody>)
List 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
generatedfrom 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
onnumeric, 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@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-ports by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PORTS] Port Bug Report: ERROR:RestrictionClauseSelectivity: bad value 164739.656250
Next
From: "Rüdiger Martin"
Date:
Subject: Problems with postgresql and Win NT