The following bug has been logged online:
Bug reference: 5105
Logged by: Walter Mesz
Email address: meszwalter@yahoo.de
PostgreSQL version: 8.4.0
Operating system: Windows XP SP2
Description: "Select Into Strict" does not throw NO_DATA_FOUND
Details:
Hi,
my problem is that this select into does not throw a NO_DATA_FOUND if my
select involves a max(). I did not see this behaviour documented anywhere
and could not find it in a reasonable time at google.
-------------code----------------------------------
create or replace function xyz() returns void as
$BODY$ declare
x integer;
begin
SELECT max(tanum)
INTO STRICT x
FROM lo_prod_req
WHERE tanum = '1234567';
raise notice 'failed';
exception
WHEN NO_DATA_FOUND
THEN
raise notice 'it should be as this';
end ;
$BODY$
LANGUAGE 'plpgsql';
-------------code----------------------------------
It does throw an Exception if I change the query into this though:
-------------code----------------------------------
SELECT tanum INTO STRICT x
FROM lo_prod_req
WHERE tanum = '1234567' limit 1;
-------------code----------------------------------
Although this query does not make much sense with the max() statement it
should work anyway
Thank you
Walter Mesz