Re: bug.. ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff MacDonald <jeff(at)hub(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: bug.. ?
Date: 2001-02-24 05:10:08
Message-ID: 10818.982991408@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jeff MacDonald <jeff(at)hub(dot)org> writes:
> A person recent pointed this out to me..
> seems a bit funny, because limit 1 pretty much
> say's it't not gonna return multiple values.

>> CREATE FUNCTION vuln_port(int4) RETURNS int4 AS 'SELECT port FROM
>> i_host_vuln WHERE vuln = $1 GROUP BY port ORDER BY count(port) DESC
>> LIMIT 1' LANGUAGE 'sql';
>>
>> The result:
>> ERROR: function declared to return int4 returns multiple values in final
>> retrieve

It's a combination of a bug and a poorly worded error message. It is
complaining not about rows, but about the extra column needed to do the
ORDER BY. The error check forgets to ignore this 'hidden' column.

Fixed some time ago for 7.1...

regards, tom lane

In response to

  • bug.. ? at 2001-02-22 19:55:03 from Jeff MacDonald

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Lance Taylor 2001-02-24 06:25:43 Re: greetings
Previous Message Ken Kline 2001-02-24 05:03:02 greetings