473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 <tw*****@bluetwanger.de>
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #1
4 1458
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)
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
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.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #3
В Птн, 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 <tw*****@bluetwanger.de>
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #4
On Fri, 09 Jul 2004 21:02:51 +0200, Markus Bertheau
<tw*****@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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: dmbkiwi | last post by:
I am new to this group, and relatively new to python programming, however, have encountered a problem I just cannot solve through reading the documentation, and searching this group on google. I...
0
by: Eddie Post | last post by:
Hellu, I want to transfer the structure of my InnoDb database to another mysql server 3.23. However, I don't seem to get this to work correctly as the tables are not transfered in the correct...
4
by: Dan | last post by:
I've encountered some strange behavior in a recursive procedure I'm writing for a bill of materials. First let me ask directly if what I think is happening is even possible: It seems like the...
2
by: champ.supernova | last post by:
Hi, I was hoping someone could help me with what I'm sure is a very simple problem...I just can't seem to find the syntax! I'm wanting to update the rows in 'tbl_consolidate' from 'tbl_hold',...
9
by: Steve Jorgensen | last post by:
Hi all, Frankly, this is such an off-beat thing, I don't know if anyone else here will ever have the same issue. Just in case anyone does, though... I needed to be able to search for the...
1
by: Thomas Schoen | last post by:
Hi, is it possible to use a parameter of a plpgsql-function to order a selection inside the function? What i would like to do is pass a column-name/alias-name to a plpgsql function and use...
104
by: Beowulf | last post by:
I have the view below and if I use vwRouteReference as the rowsource for a combo box in an MS Access form or run "SELECT * FROM vwRouteReference" in SQL Query Analyzer, the rows don't come through...
29
by: pb648174 | last post by:
I have the following basic statements being executed: Create a temp table, #TempPaging Insert Into #TempPaging (Col1, Col2) Select Col1, Col2 From SomeOtherTable Order By Col2, Col1 Select...
5
by: tshad | last post by:
I have a PageInit.ascx that I want to put in all my pages and have it execute only once during the "not IsPostback" section. I also need it to execute first before anything else. I have it set...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.