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

From: Unprivileged user <nobody>
To: pgsql-ports(at)postgresql(dot)org
Subject: Port Bug Report: Command "CREATE TABLE AS with SELECT ... UNION" don't work
Date: 1999-07-09 08:30:31
Message-ID: 199907090830.EAA85571@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports


============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Angelo CONFLITTI
Your email address : mvca(at)yahoo(dot)com

Category : unknown
Severity : non-critical

Summary: Command "CREATE TABLE AS with SELECT ... UNION" don't work

System Configuration
--------------------
Operating System : Linux 2.2.5 (RedHat 6.0)

PostgreSQL version : 6.5

Compiler used : egcs-2.91.66

Hardware:
---------
i486 24MB RAM, on intranet ethernet, no X-window

Versions of other tools:
------------------------
gmake 3.77, flex 2.5.4

--------------------------------------------------------------------------

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:
---------

--------------------------------------------------------------------------

Responses

Browse pgsql-ports by date

  From Date Subject
Next Message Unprivileged user 1999-07-09 12:44:14 Port Bug Report: ERROR:RestrictionClauseSelectivity: bad value 164739.656250
Previous Message Palle Girgensohn 1999-07-09 04:12:38 Re: [PORTS] Port Bug Report: connecting with psql v. 6.4.2 kill 6.5 backend!