On Friday 20. February 2009, Adrian Klaver wrote:
>On Friday 20 February 2009 6:29:43 am Leif B. Kristensen wrote:
>> About twenty years ago I wrote a lot of Turbo Pascal code, and IIRC
>> semicolon after an END was allowed but considered bad style.

The rules concerning ENDs and semicolons in Pascal were quite more 
complex than that. I won't try to make a synopsis here as it's 
massively off-topic. These days I prefer languages with curly braces as 
block delimiters; however the old Pascal exposure does come back when I 
write sprocs in Postgres.

Actually, I believe that the syntax is derived from ALGOL, the 
grandmother of all structured languages, rather than Pascal.

>Learned something new. I went and reread the docs and found:
>
>"Each declaration and each statement within a block is terminated by a
>semicolon. A block that appears within another block must have a
> semicolon after END, as shown above; however the final END that
> concludes a function body does not require a semicolon."
>
>I have always seen them terminated with a semicolon and did that
> assuming thing.

«Assumption is the mother of all fuckups» :-)

IMHO, someone should revise the syntax of the example in the document  
(http://www.postgresql.org/docs/current/interactive/plpgsql-structure.html) 
to state that the semicolon after the final END is not required.
-- 
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to