Thread: union problem version 6.5.3

union problem version 6.5.3

From
Frans Van Elsacker
Date:
Probably it is of interest for jou, or i did something very stupid:
I had a little piece of code who works fine up till know, just after
installing 
the version 6.5.3 i got the message 'parse error near union'


create table work asselect * from opdrachtunionselect * from opdrachtproost

I know i can solve the problem with insert into work in stead of the union keyword, but it is enoying that all
the programs had to be recompiled

many thanks, its a good product

Frans




Re: [HACKERS] union problem version 6.5.3

From
Tom Lane
Date:
Frans Van Elsacker <fve@atbib.be> writes:
> I had a little piece of code who works fine up till know, just after
> installing 
> the version 6.5.3 i got the message 'parse error near union'

> create table work as
>     select * from opdracht
>     union
>     select * from opdrachtproost

Hmm, the grammar has

CreateAsStmt:  CREATE OptTemp TABLE relation_name OptCreateAs AS SubSelect

and SubSelect doesn't allow unions.  This is overly restrictive,
I agree, but I thought it had been that way for a good while.
What version were you using before?
        regards, tom lane


Re: [HACKERS] union problem version 6.5.3

From
Frans Van Elsacker
Date:
thanks for your quick answer,

Our earlier version was postgresql 6.4.2

Regards, Frans





At 10:34 12/11/99 -0500, Tom Lane wrote:
>Frans Van Elsacker <fve@atbib.be> writes:
>> I had a little piece of code who works fine up till know, just after
>> installing 
>> the version 6.5.3 i got the message 'parse error near union'
>
>> create table work as
>>     select * from opdracht
>>     union
>>     select * from opdrachtproost
>
>Hmm, the grammar has
>
>CreateAsStmt:  CREATE OptTemp TABLE relation_name OptCreateAs AS SubSelect
>
>and SubSelect doesn't allow unions.  This is overly restrictive,
>I agree, but I thought it had been that way for a good while.
>What version were you using before?
>
>            regards, tom lane
>
>************
>
>



Re: [HACKERS] union problem version 6.5.3

From
Tom Lane
Date:
Frans Van Elsacker <fve@atbib.be> writes:
> Our earlier version was postgresql 6.4.2

OK, I thought the change was older than that.  It probably got into 6.5
as a side-effect of incorporating the INTERSECT/EXCEPT feature.  Anyway,
we ought to try to restore the old functionality.
        regards, tom lane

>> Hmm, the grammar has
>> 
>> CreateAsStmt:  CREATE OptTemp TABLE relation_name OptCreateAs AS SubSelect
>> 
>> and SubSelect doesn't allow unions.  This is overly restrictive,
>> I agree, but I thought it had been that way for a good while.
>> What version were you using before?


Re: [HACKERS] union problem version 6.5.3

From
Tom Lane
Date:
>>> Hmm, the grammar has
>>> 
>>> CreateAsStmt:  CREATE OptTemp TABLE relation_name OptCreateAs AS SubSelect
>>> 
>>> and SubSelect doesn't allow unions.  This is overly restrictive,

As far as I can tell, it should work to just change the above line in
src/backend/parser/gram.y to

CreateAsStmt:  CREATE OptTemp TABLE relation_name OptCreateAs AS SelectStmt

I am doing this in current sources right now.  I have not tried it in
REL6_5, but if the problem is getting in your way then give it a try...
        regards, tom lane