BUG #16181: Error Creating Stored Procedures

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: shahzadahmad00(at)gmail(dot)com
Subject: BUG #16181: Error Creating Stored Procedures
Date: 2020-01-01 23:42:44
Message-ID: 16181-3b69f6cdd6047372@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: 16181
Logged by: Shahzad Ahmad
Email address: shahzadahmad00(at)gmail(dot)com
PostgreSQL version: 12.1
Operating system: Ubuntu 18.04.3 LTS
Description:

I tried both pgAdmin GUI and psql using a script file. In both instances i
got the same error.

CREATE OR REPLACE PROCEDURE admin.my_test(IN role_id integer DEFAULT 0)
LANGUAGE 'plpgsql'

AS $BODY$
IF my_test.user_id = 0 THEN
Select *
from admin.roles
order by role_name;
ELSE
Select *
from admin.roles
WHERE role_id = my_test.user_id
order by role_name;
END IF;
$BODY$;

ERROR: syntax error at or near "IF"
LINE 5: IF my_test.user_id = 0 THEN
^
SQL state: 42601
Character: 103

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2020-01-02 00:01:32 Re: BUG #16181: Error Creating Stored Procedures
Previous Message Daniel Gustafsson 2020-01-01 19:54:13 Re: pgAdmin 4