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

From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <daniel_schuchardt(at)web(dot)de>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpgsql NULL statement (was Re: [GENERAL] Postgres 8.0 -> BEGIN EXCEPTION END Syntax????)
Date: 2004-08-16 05:38:42
Message-ID: 2855.24.211.141.25.1092634722.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane said:
> 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?
>

It's got my vote :-) PLSQL is based on Ada and this is an Ada rule. I like
the PLSQL/Ada way a lot more than the PostgreSQL example you gave above,
which just looks ... odd.

cheers

andrew

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Giannis Vrentzos 2004-08-16 05:51:14 Re: case insensitive search with greek characters
Previous Message Peter Eisentraut 2004-08-16 05:31:34 Re: PHP Postgre-MySql call redirector

Browse pgsql-hackers by date

  From Date Subject
Next Message Dennis Bjorklund 2004-08-16 06:43:05 Re: plpgsql NULL statement (was Re: [GENERAL] Postgres
Previous Message Bruce Momjian 2004-08-16 04:37:18 Re: fix schema ownership on first connection preliminary