Обсуждение: semicolon not required on END statement

Поиск
Список
Период
Сортировка

semicolon not required on END statement

От
Hussein Patni
Дата:

			
		

Re: semicolon not required on END statement

От
Neil Conway
Дата:
On Fri, 2004-10-01 at 01:11, Hussein Patni wrote:
> I noticed in plpgsql that a semi colon is not always requiredafter
> the END statement.

Yeah, I've noticed this as well (although it doesn't appear to be
documented). Would we gain anything by enforcing this restriction? IMHO
not a lot...

-Neil

Re: semicolon not required on END statement

От
Tom Lane
Дата:
Neil Conway <neilc@samurai.com> writes:
> On Fri, 2004-10-01 at 01:11, Hussein Patni wrote:
>> I noticed in plpgsql that a semi colon is not always requiredafter
>> the END statement.

> Yeah, I've noticed this as well (although it doesn't appear to be
> documented). Would we gain anything by enforcing this restriction? IMHO
> not a lot...

We specifically do not require a semicolon at the very end of the
function definition.  My recollection is that the plpgsql grammar did
originally enforce that, and we relaxed it because it confused people.
You have to admit that
    ... END;';
is a bit odd-looking.

            regards, tom lane

Re: semicolon not required on END statement

От
Neil Conway
Дата:
On Fri, 2004-10-01 at 13:46, Tom Lane wrote:
> We specifically do not require a semicolon at the very end of the
> function definition.

Yeah, makes sense. Attached is a doc patch. Barring any objections I'll
apply it to HEAD by end-of-day today.

-Neil


Вложения

Re: semicolon not required on END statement

От
Bruce Momjian
Дата:
Improved wording that doesn't telegraph, "Look at me!":

    Each declaration and each statement within a block is terminated by a
    semicolon, though the final <literal>END</literal> that concludes a
    function does not require one.


---------------------------------------------------------------------------

Neil Conway wrote:
> On Fri, 2004-10-01 at 13:46, Tom Lane wrote:
> > We specifically do not require a semicolon at the very end of the
> > function definition.
>
> Yeah, makes sense. Attached is a doc patch. Barring any objections I'll
> apply it to HEAD by end-of-day today.
>
> -Neil
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: semicolon not required on END statement

От
Neil Conway
Дата:
Bruce Momjian wrote:
> Improved wording that doesn't telegraph, "Look at me!":
>
>     Each declaration and each statement within a block is terminated by a
>     semicolon, though the final <literal>END</literal> that concludes a
>     function does not require one.

Patch applied.

-Neil