Re: [HACKERS] Error in parser with UNIONS.

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Chris Albertson <chris(at)topdog(dot)pas1(dot)logicon(dot)com>, pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] Error in parser with UNIONS.
Date: 1998-05-22 15:38:46
Message-ID: 35659C06.85048A4D@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Made some progress:

postgres=> select 1.2 as float8 union select 1;
float8
------
1
1.2
(2 rows)

postgres=> select text 'a' as text union select 'b';
text
----
a
b
(2 rows)

At the moment I'm forcing the types of the union to match the types of
the first/top clause in the union:

postgres=> select 1 as all_integers
postgres-> union select '2.2'::float4 union select 3.3;
all_integers
------------
1
2
3
(3 rows)

The better strategy might be to choose the "best" type of the bunch, but
is more difficult because of the nice recursion technique used in the
parser. However, it does work OK when selecting _into_ a table:

postgres=> create table ff (f float);
CREATE
postgres=> insert into ff
postgres-> select 1 union select '2.2'::float4 union select 3.3;
INSERT 0 3
postgres=> select * from ff;
f
----------------
1
2.20000004768372
3.3
(3 rows)

Comments??

- Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message serj 1998-05-22 15:49:21 destroydb fail in pgsql CVS from 22.5.98
Previous Message Tatsuo Ishii 1998-05-22 15:29:55 Re: [HACKERS] Current sources?