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

From Andrew Dunstan
Subject Re: plpgsql NULL statement (was Re: [GENERAL] Postgres 8.0 -> BEGIN EXCEPTION END Syntax????)
Date
Msg-id 2855.24.211.141.25.1092634722.squirrel@www.dunslane.net
Whole thread Raw
In response to plpgsql NULL statement (was Re: [GENERAL] Postgres 8.0 -> BEGIN EXCEPTION END Syntax????)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane said:
> Daniel Schuchardt <daniel_schuchardt@web.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




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: plpgsql NULL statement (was Re: [GENERAL] Postgres 8.0 -> BEGIN EXCEPTION END Syntax????)
Next
From: Dennis Bjorklund
Date:
Subject: Re: plpgsql NULL statement (was Re: [GENERAL] Postgres