Found a bug in the procedural languages code relating to LIMIT 1

Поиск
Список
Период
Сортировка
От
Тема Found a bug in the procedural languages code relating to LIMIT 1
Дата
Msg-id 20010111131343.1629.qmail@mailhost.sidereal.kz
обсуждение исходный текст
Ответы Re: Found a bug in the procedural languages code relating to LIMIT 1
Re: Found a bug in the procedural languages code relating to LIMIT 1
Список pgsql-general
Try a function like this:

CREATE FUNCTION foo(...) RETURNS INT4 AS '
SELECT shoesize FROM customers ORDER BY time LIMIT 1
' LANGUAGE 'sql';

It gives an error that returning multiple values is not allowed.  It
clearly does not return multiple values; it has a LIMIT 1.  So I think
this is a bug.  Is there any other better way to do this perhaps?  Is
there a way to find a row where some field is the most in its range?
In my application I'm having to do this a lot.

The workaround that I found is to do this in plpgsql.  I can do it
like this:

DECLARE result INT4;
SELECT shoesize INTO result ...
RETURN result;
END;

but I should be able to do this in sql, not plpgsql.

Thanks for any help

В списке pgsql-general по дате отправления:

Предыдущее
От: "rob"
Дата:
Сообщение: Re: [HACKERS] Re: still no log
Следующее
От: Tod McQuillin
Дата:
Сообщение: Re: Found a bug in the procedural languages code relating to LIMIT 1