BUG #5105: "Select Into Strict" does not throw NO_DATA_FOUND

From: "Walter Mesz" <meszwalter(at)yahoo(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5105: "Select Into Strict" does not throw NO_DATA_FOUND
Date: 2009-10-08 14:42:25
Message-ID: 200910081442.n98EgPQF096076@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5105
Logged by: Walter Mesz
Email address: meszwalter(at)yahoo(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2009-10-08 14:54:51 Re: BUG #5102: Silent IN (list of strings) failure to detect syntax error when list is linewrapped
Previous Message Herve LEFEBVRE 2009-10-08 08:06:10 BUG #5104: tsearch parser mislead