BUG #13708: strange behaviour instead of syntax error

From: yozh(dot)ne(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13708: strange behaviour instead of syntax error
Date: 2015-10-23 10:03:39
Message-ID: 20151023100339.931.54397@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13708
Logged by: Albert Nurgaleyev
Email address: yozh(dot)ne(at)gmail(dot)com
PostgreSQL version: 9.2.4
Operating system: Red Hat
Description:

In the code below - if I remove semicolon after "po_result := 'ERROR: No
uncollected prize found!'" then no syntax error occurs, return statement is
just ignored instead

create table test_table(
col1 INTEGER, col2 INTEGER
);

DO $$
DECLARE
v_status INTEGER;
po_result VARCHAR;
BEGIN

UPDATE test_table
SET col1 = 2
WHERE 2=3
RETURNING col2
INTO v_status;

IF NOT FOUND THEN
po_result := 'ERROR: No uncollected prize found!'
RETURN;
END IF;

RAISE EXCEPTION 'Error';

END;
$$;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Gould 2015-10-23 12:45:10 Re: BUG #13702: pg_dump interprets “=” in a db name incorrectly
Previous Message Tom Lane 2015-10-23 02:59:27 Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')