Stored functions
The on-line manual,
http://www.postgresql.org/docs/8.0/interactive/index.html,
doesn't describe how to call stored functions, or if it does
it's well hidden.
Are there some examples anywhere? After
googling I can find much duplication of non-data (people
love to mirror sites don't they?) but no real examples.
-Nigel
am 19.08.2005, um 12:07:57 +0100 mailte Nigel Horne folgendes:
The on-line manual,
http://www.postgresql.org/docs/8.0/interactive/index.html,
doesn't describe how to call stored functions, or if it does
it's well hidden.
test=# create function get_foobar () returns varchar as $$begin return 'foobar'; end;$$ language plpgsql;
CREATE FUNCTION
test=# select get_foobar();
get_foobar
------------
foobar
(1 row)
Okay?
Regards, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
On Fri, Aug 19, 2005 at 12:07:57PM +0100, Nigel Horne wrote:
The on-line manual,
http://www.postgresql.org/docs/8.0/interactive/index.html,
doesn't describe how to call stored functions, or if it does
it's well hidden.Are there some examples anywhere? After
googling I can find much duplication of non-data (people
love to mirror sites don't they?) but no real examples.
I havn't checked the docs, but it is be exactly the same as normal
functions:
select my_new_function(1);
select my_new_function(col) from table;
etc...
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.
Nigel Horne schrieb:
The on-line manual,
http://www.postgresql.org/docs/8.0/interactive/index.html,
doesn't describe how to call stored functions, or if it does
it's well hidden.Are there some examples anywhere? After
googling I can find much duplication of non-data (people
love to mirror sites don't they?) but no real examples.
http://www.postgresql.org/docs/8.0/interactive/plpgsql-control-structures.html
it depends on the type of function how to use it.
Simple, value returning functions would be called just
like any other SQL builtin function:
SELECT yourfunction(arg1,arg2), othercoulmns, ... FROM ...
or SELECT yourfunction(arg1,arg2); if you just want to
call this function.
Set returning functions can be used like this
or SELECT col1,col2 FROM yoursetreturningfunction();
or SELECT yoursetreturningfunction();
or even in JOINs
Nigel Horne <njh@bandsman.co.uk> writes:
The on-line manual,
http://www.postgresql.org/docs/8.0/interactive/index.html,
doesn't describe how to call stored functions, or if it does
it's well hidden.
Start here:
http://www.postgresql.org/docs/8.0/static/xfunc.html
http://www.postgresql.org/docs/8.0/static/xfunc-sql.html
If that first page already throws you, try backing up to the
beginning of the chapter,
http://www.postgresql.org/docs/8.0/static/extend.html
regards, tom lane
Thanks for all the pointers. I'll have a look. I did reply
earlier, but the "reply to" is broken: it sent to the OP
rather than the list...
Perhaps there is a lesson in newbie navigation for the
website here.
-Nigel
On Fri, Aug 19, 2005 at 15:15:44 +0100,
Nigel Horne <njh@bandsman.co.uk> wrote:
Thanks for all the pointers. I'll have a look. I did reply
earlier, but the "reply to" is broken: it sent to the OP
rather than the list...
No it isn't broken. You should use the reply to all function of your mail
client when replying to a list. Normal reply is used when you want to only
reply to the poster.