pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: shahzadahmad00@gmail.com
Subject: BUG #16181: Error Creating Stored Procedures
Date: Wed, 01 Jan 2020 23:42:44 +0000
Message-ID: <16181-3b69f6cdd6047372@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16181
Logged by:          Shahzad Ahmad
Email address:      shahzadahmad00@gmail.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



view thread (3+ messages)  latest in thread

Message-ID: <16181-3b69f6cdd6047372@postgresql.org>
Permalink:  ../16181-3b69f6cdd6047372@postgresql.org/
Also on:    postgresql.org/message-id/16181-3b69f6cdd6047372@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, shahzadahmad00@gmail.com
  Subject: Re: BUG #16181: Error Creating Stored Procedures
  In-Reply-To: <16181-3b69f6cdd6047372@postgresql.org>
  References: <16181-3b69f6cdd6047372@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox