Re: [HACKERS] Error in parser with UNIONS.

From: dg(at)illustra(dot)com (David Gould)
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: 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-31 05:29:43
Message-ID: 9805310529.AA26459@hawk.illustra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane he say:
> 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??
>

Great stuff!
-dg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-05-31 05:51:30 Re: [HACKERS] Re: [DOCS] Re: FE/BE protocol revision patch
Previous Message David Gould 1998-05-31 05:18:03 Re: [HACKERS] Re: [DOCS] Re: FE/BE protocol revision patch