plpgsql NULL statement (was Re: [GENERAL] Postgres 8.0 -> BEGIN EXCEPTION END Syntax????)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Schuchardt <daniel_schuchardt(at)web(dot)de>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: plpgsql NULL statement (was Re: [GENERAL] Postgres 8.0 -> BEGIN EXCEPTION END Syntax????)
Date: 2004-08-16 04:12:21
Message-ID: 3813.1092629541@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Daniel Schuchardt <daniel_schuchardt(at)web(dot)de> writes:
> BEGIN
> exception ...
> EXCEPTION
> WHEN OTHERS THEN ?????????????what to write for do nothing?????????
> END;

> in oracle it's
> WHEN OTHERS THEN null;
> but this syntax doesn't work in postgres.

In Postgres you just write nothing at all:

BEGIN
...
EXCEPTION
WHEN OTHERS THEN
END;

However, it does appear that Oracle's PL/SQL has such a statement,
and that they don't like empty exception sections (or empty if/then/else
arms, etc), but *require* you to write "NULL;" in these places.
It seems to me that it would ease porting of Oracle functions if
we allowed a NULL statement in plpgsql.

It looks like about five minutes' work to add such a thing ... anyone
have any objections?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2004-08-16 05:31:34 Re: PHP Postgre-MySql call redirector
Previous Message Grant Allen 2004-08-16 04:01:01 Re: Error codes to go with errors?

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-08-16 04:37:18 Re: fix schema ownership on first connection preliminary
Previous Message Bruce Momjian 2004-08-16 01:36:03 Re: Postgresql.conf Documentation change