473,770 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Nov 23 '05 #1
4 1484
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*****@bluetw anger.de>
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.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*****@bluetw anger.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
97204
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 have written a theme in python for the superkaramba theme engine on kde (see http://netdragon.sourceforge.net - if you are a kde/linux user, it is a great visual applet engine). I have uploaded it to www.kdelook.org for others to download and...
0
1423
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 order such that I get a bunch a foreign key constraints. Even if I use the MysqlPhp admin tool, Mysql Manager, SqlYog, it doesn't work: they make an export of the db structure but the db structure, that consists of create table statements, isn't...
4
2580
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 procedure is not following the recursion in serial order, but in parallel. In other words, after one instance of the procedure calls itself, it continues executing lines below the recursion before the recursion is done. Is that possible? I...
2
54465
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', but working through the records in 'tbl_hold' in the order of dates in a date field, rather than the order that the rows are necessarily in. I came up with the following code to do this:
9
3753
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 first string in a recordset that is the same as a specified string value, or the one that would be right after that if it doesn't exist. Several searches per second may occur, so I needed to search within the recordset first, and only query the...
1
4665
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 the variable as order-by-parameter like this: create function foo(varchar) RETURNS SETOF test AS '
104
10900
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 sorted by Numb. Everything I've read on the web suggests that including the TOP directive should enable ORDERY BY in views. Does someone have an idea why the sorting is not working correctly for this particular view? thanks. CREATE VIEW...
29
27607
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 * from #TempPaging I can't provide a reproduceable scenario right now without making this
5
2341
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 as: <%@ Register TagPrefix="fts" TagName="pageInit" Src="/controls/pageInit.ascx" %> .... <body>
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.