Re: Creating a function with single quotes - Mailing list pgsql-sql

From Leif B. Kristensen
Subject Re: Creating a function with single quotes
Date
Msg-id 200902201602.15541.leif@solumslekt.org
Whole thread Raw
In response to Re: Creating a function with single quotes  (Adrian Klaver <aklaver@comcast.net>)
List pgsql-sql
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/


pgsql-sql by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Creating a function with single quotes
Next
From: "M.P.Dankoor"
Date:
Subject: Re: How concat 3 strings if 2 are not empty?