Re: Proposal - Continue stmt for PL/pgSQL

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal - Continue stmt for PL/pgSQL
Date: 2005-06-16 19:44:06
Message-ID: Pine.LNX.4.44.0506162124420.13602-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Well, yes, but I don't think we should break compatibility
> arbitrarilly. I guess it could be argued that this is a missing feature
> in PL/SQL and its Ada parent - implementing GOTO just to handle this
> case seems unnecessary.

Yes. I din't use goto 5 years :-). Continue stmt is more cleaner and
readable.

now:

FOR i IN 1 .. 100 LOOP
continue := true
WHILE continue LOOP
...
EXIT; -- contine
continue := false; -- really exit
END LOOP;
END LOOP;

with continue

FOR i IN 1 .. 100 LOOP
...
EXIT WHEN ..
CONTINUE WHEN ..
END LOOP;

One argument for continue inside begin block - for discussion only.
on loop exit means break iteration, continue new iteration. Continue and
Exit are symmetric.

I didn't know ADA haven't continue. In PL/pgSQL there isn't any problem
implement continue stmt (wit any face), but goto stmt means relative big
changes in source code.

Pavel

>
> I agree with Tom that it should only be allowed inside a loop.
>
> cheers
>
> andrew
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2005-06-16 20:06:49 Utility database (Was: RE: Autovacuum in the backend)
Previous Message Pavel Stehule 2005-06-16 19:14:34 Re: Proposal - Continue stmt for PL/pgSQL