Thread: 7.1 feature?

7.1 feature?

From
Kaare Rasmussen
Date:
I need to do something like this:

SELECT n.name FROM 
(SELECT p.contact_seq AS contact_seq, p.lastname||', '||p.firstname AS name 
FROM person p
UNION SELECT co.name AS name FROM company co) n;

Of course there's more; this is cut from the original select.
But PostgreSQL complains about SELECT (i guess it's the SELECT in the 
subquery)
In the dox I read:

A FROM item can also be a parenthesized sub-SELECT (note that an alias clause 
is required for a sub-SELECT!). This is an extremely handy feature since it's 
the only way to get multiple levels of grouping, aggregation, or sorting in a 
single query. 

Is this a 7.1 feature? Or is my typing wrong?
And will 7.1 support unions in subselects like above?

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 14.00-18.00        Email: kar@webline.dk
2000 Frederiksberg        Lørdag 11.00-17.00       Web:      www.suse.dk


Re: 7.1 feature?

From
Tom Lane
Date:
Kaare Rasmussen <kar@webline.dk> writes:
> In the dox I read:

You're reading the 7.1 docs.  7.0 docs live at
http://www.postgresql.org/users-lounge/docs/7.0/postgres/postgres.htm
        regards, tom lane