Re: Functions returning sets - Mailing list pgsql-hackers

From Don Baccus
Subject Re: Functions returning sets
Date
Msg-id 3.0.1.32.20010519160837.01634c40@mail.pacifier.com
Whole thread Raw
In response to Functions returning sets  (mlw <markw@mohawksoft.com>)
Responses Re: Functions returning sets  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
At 02:08 PM 5/19/01 -0700, Stephan Szabo wrote:
>
>(Machine couldn't find mx record for mohawksoft, replying only
>to list)
>
>On Sat, 19 May 2001, mlw wrote:
>
>> Sorry to gripe here. Don't get me wrong, I think Postgres is amazing, and I
>> think all you guys do an amazing job. 
>> 
>> Is it just me, or do others agree, functions returning sets need to be able to
>> be used in a select where equal clause.
>>
>> select * from table where field = funct_set('bla bla');
>
>I think what we should probably do is make IN better...

IN is the right operator.  "field = [set of rows]" isn't SQL92 and doesn't
really make sense.   It's the equivalent of:

select * from table where field = (select some_column from some_other_table)

If the subselect returns a single row it will work, if it returns multiple
rows you need to use IN.  That's just how SQL92 is defined.

I'd assume that a function returning a single column and single row will
work just as the subselect does, but there's no reason expect it to work
if more than one row is returned.

What's so hard about writing "IN" rather than "=" ???



- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.
 


pgsql-hackers by date:

Previous
From: Mike Mascari
Date:
Subject: RE: Re: Functions returning sets
Next
From: "Joe Conway"
Date:
Subject: Re: Re: Functions returning sets