Re: [SQL] SELECT composite type

2006-04-06 Thread Michael Burke
On Wednesday 05 April 2006 19:29, Tom Lane wrote: > Niklas Johansson <[EMAIL PROTECTED]> writes: > > You could try > > > > SELECT foo.x, foo.y, title FROM > > (SELECT > >get_xy(SetSRID(sightings.location, 26910), 4326) AS foo, > >sightings.title > > FROM sightings > > WHERE sighting_id = 25

Re: [SQL] SELECT composite type

2006-04-06 Thread Markus Schaber
Hi, Michael, Michael Burke wrote: > This statement works, but I don't want to duplicate the function call as this > should be unnecessary. Is this for aesthetic reasons (typing the query), or for speed reasons? If the latter one is true, then check that all functions are defined as "immutable"

Re: [SQL] SELECT composite type

2006-04-05 Thread Tom Lane
Niklas Johansson <[EMAIL PROTECTED]> writes: > On 5 apr 2006, at 17.57, Michael Burke wrote: >> So I basically want to call get_xy for every row in >> sightings, and use its output for two columns; or perhaps there is >> another way to think of this. > You could try > SELECT foo.x, foo.y, title

Re: [SQL] SELECT composite type

2006-04-05 Thread Niklas Johansson
On 5 apr 2006, at 17.57, Michael Burke wrote: So I basically want to call get_xy for every row in sightings, and use its output for two columns; or perhaps there is another way to think of this. You could try SELECT foo.x, foo.y, title FROM (SELECT get_xy(SetSRID(sightings.location, 26

[SQL] SELECT composite type

2006-04-05 Thread Michael Burke
Hello, I have a function get_xy that returns a composite type with columns "x" and "y". I would like to SELECT these as well as some data from a table, like so: SELECT (get_xy(SetSRID(sightings.location, 26910), 4326)).x, (get_xy(SetSRID(sightings.location, 26910), 4326)).y, sightings.t