diff options
author | Neil Conway | 2005-07-02 08:59:48 +0000 |
---|---|---|
committer | Neil Conway | 2005-07-02 08:59:48 +0000 |
commit | c425dcb4ec9ac9aff9e241e0adcf309d2f419ba1 (patch) | |
tree | 0f56275f049fca1f4d18e561cdfbf14288159ed5 /doc/src | |
parent | 784b948984a529991f86bbefd4013ef98f984996 (diff) |
In PL/PgSQL, allow a block's label to be optionally specified at the
end of the block:
<<label>>
begin
...
end label;
Similarly for loops. This is per PL/SQL. Update the documentation and
add regression tests. Patch from Pavel Stehule, code review by Neil
Conway.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/plpgsql.sgml | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index e8d687928f8..ad6b1c84944 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.74 2005/06/22 01:35:02 neilc Exp $ +$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.75 2005/07/02 08:59:47 neilc Exp $ --> <chapter id="plpgsql"> @@ -456,7 +456,7 @@ a_output := a_output || $$ if v_$$ || referrer_keys.kind || $$ like '$$ <replaceable>declarations</replaceable> </optional> BEGIN <replaceable>statements</replaceable> -END; +END <optional> <replaceable>label</replaceable> </optional>; </synopsis> </para> @@ -1789,18 +1789,19 @@ END IF; <title><literal>LOOP</></title> <synopsis> -<optional><<<replaceable>label</replaceable>>></optional> +<optional> <<<replaceable>label</replaceable>>> </optional> LOOP <replaceable>statements</replaceable> -END LOOP; +END LOOP <optional> <replaceable>label</replaceable> </optional>; </synopsis> <para> - <literal>LOOP</> defines an unconditional loop that is repeated indefinitely - until terminated by an <literal>EXIT</> or <command>RETURN</command> - statement. The optional label can be used by <literal>EXIT</> statements in - nested loops to specify which level of nesting should be - terminated. + <literal>LOOP</> defines an unconditional loop that is repeated + indefinitely until terminated by an <literal>EXIT</> or + <command>RETURN</command> statement. The optional + <replaceable>label</replaceable> can be used by <literal>EXIT</> + and <literal>CONTINUE</literal> statements in nested loops to + specify which loop the statement should be applied to. </para> </sect3> @@ -1920,10 +1921,10 @@ END LOOP; </indexterm> <synopsis> -<optional><<<replaceable>label</replaceable>>></optional> +<optional> <<<replaceable>label</replaceable>>> </optional> WHILE <replaceable>expression</replaceable> LOOP <replaceable>statements</replaceable> -END LOOP; +END LOOP <optional> <replaceable>label</replaceable> </optional>; </synopsis> <para> @@ -1951,10 +1952,10 @@ END LOOP; <title><literal>FOR</> (integer variant)</title> <synopsis> -<optional><<<replaceable>label</replaceable>>></optional> +<optional> <<<replaceable>label</replaceable>>> </optional> FOR <replaceable>name</replaceable> IN <optional> REVERSE </optional> <replaceable>expression</replaceable> .. <replaceable>expression</replaceable> LOOP <replaceable>statements</replaceable> -END LOOP; +END LOOP <optional> <replaceable>labal</replaceable> </optional>; </synopsis> <para> @@ -1997,10 +1998,10 @@ END LOOP; the results of a query and manipulate that data accordingly. The syntax is: <synopsis> -<optional><<<replaceable>label</replaceable>>></optional> +<optional> <<<replaceable>label</replaceable>>> </optional> FOR <replaceable>record_or_row</replaceable> IN <replaceable>query</replaceable> LOOP <replaceable>statements</replaceable> -END LOOP; +END LOOP <optional> <replaceable>label</replaceable> </optional>; </synopsis> The record or row variable is successively assigned each row resulting from the <replaceable>query</replaceable> (which must be a @@ -2036,10 +2037,10 @@ $$ LANGUAGE plpgsql; The <literal>FOR-IN-EXECUTE</> statement is another way to iterate over rows: <synopsis> -<optional><<<replaceable>label</replaceable>>></optional> +<optional> <<<replaceable>label</replaceable>>> </optional> FOR <replaceable>record_or_row</replaceable> IN EXECUTE <replaceable>text_expression</replaceable> LOOP <replaceable>statements</replaceable> -END LOOP; +END LOOP <optional> <replaceable>label</replaceable> </optional>; </synopsis> This is like the previous form, except that the source <command>SELECT</command> statement is specified as a string |