order of statements in create function
Hi,
why does everyone write
CREATE FUNCTION foo() RETURNS INTEGER AS '
blah blah
' LANGUAGE 'plpgsql';
I've never seen for example:
CREATE FUNCTION foo()
RETURNS INTEGER
LANGUAGE 'plpgsql'
AS '
blah blah
';
Is there a special reason to this? I have a hard time believing that
everyone does it the same way by coincidence.
Thanks.
--
Markus Bertheau <twanger@bluetwanger.de>
On Fri, Jul 09, 2004 at 07:16:14PM +0200, Markus Bertheau wrote:
why does everyone write
CREATE FUNCTION foo() RETURNS INTEGER AS '
blah blah
' LANGUAGE 'plpgsql';I've never seen for example:
CREATE FUNCTION foo()
RETURNS INTEGER
LANGUAGE 'plpgsql'
AS '
blah blah
';Is there a special reason to this? I have a hard time believing that
everyone does it the same way by coincidence.
I think previous versions only allowed the language specification at the
end. I got used to putting it before the function text though, so if
you are able to read something written by me you'd see that.
That was your point, wasn't it?
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"In fact, the basic problem with Perl 5's subroutines is that they're not
crufty enough, so the cruft leaks out into user-defined code instead, by
the Conservation of Cruft Principle." (Larry Wall, Apocalypse 6)
Markus Bertheau wrote:
why does everyone write
CREATE FUNCTION foo() RETURNS INTEGER AS '
blah blah
' LANGUAGE 'plpgsql';I've never seen for example:
CREATE FUNCTION foo()
RETURNS INTEGER
LANGUAGE 'plpgsql'
AS '
blah blah
';Is there a special reason to this? I have a hard time believing that
everyone does it the same way by coincidence.
The first used to be the only allowed order, before we made it more
flexible, as specified by the SQL standard.
В Птн, 09.07.2004, в 20:24, Alvaro Herrera пишет:
On Fri, Jul 09, 2004 at 07:16:14PM +0200, Markus Bertheau wrote:
why does everyone write
CREATE FUNCTION foo() RETURNS INTEGER AS '
blah blah
' LANGUAGE 'plpgsql';I've never seen for example:
CREATE FUNCTION foo()
RETURNS INTEGER
LANGUAGE 'plpgsql'
AS '
blah blah
';Is there a special reason to this? I have a hard time believing that
everyone does it the same way by coincidence.I think previous versions only allowed the language specification at the
end. I got used to putting it before the function text though, so if
you are able to read something written by me you'd see that.That was your point, wasn't it?
Yes, it was. Thanks to you and Peter for explaining it.
--
Markus Bertheau <twanger@bluetwanger.de>
On Fri, 09 Jul 2004 21:02:51 +0200, Markus Bertheau
<twanger@bluetwanger.de> wrote:
В Птн, 09.07.2004, в 20:24, Alvaro Herrera пишет:
On Fri, Jul 09, 2004 at 07:16:14PM +0200, Markus Bertheau wrote:
why does everyone write
CREATE FUNCTION foo() RETURNS INTEGER AS '
blah blah
' LANGUAGE 'plpgsql';I've never seen for example:
CREATE FUNCTION foo()
RETURNS INTEGER
LANGUAGE 'plpgsql'
AS '
blah blah
';Is there a special reason to this? I have a hard time believing that
everyone does it the same way by coincidence.I think previous versions only allowed the language specification at the
end. I got used to putting it before the function text though, so if
you are able to read something written by me you'd see that.That was your point, wasn't it?
As an aside, if you look in the book PostgreSQL by Korry Douglas, he
uses examples with the type before body style formatting. It was so
wierd when I looked at it I had to try it myself just to make sure it
worked :-) If you look in the docs though, they use the "normal"
formatting which is why most people stick to that convention.
Robert Treat
--
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL