Re: Postgresql database procedures?

From: David Fetter <david(at)fetter(dot)org>
To: zhong ming wu <mr(dot)z(dot)m(dot)wu(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgresql database procedures?
Date: 2010-08-04 13:45:58
Message-ID: 20100804134558.GB25060@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 04, 2010 at 07:38:15AM -0400, zhong ming wu wrote:
> On Wed, Aug 4, 2010 at 7:32 AM, Machiel Richards <machielr(at)rdc(dot)co(dot)za> wrote:
> > Good day all
> >
> > I am looking for some info / resources where I can learn how to
> > write database procedures, functions,etc?

Do you have any particular tasks in mind? Since PostgreSQL lets you
use the vast majority of common programming languages to do this, it
would be helpful if you mentioned one or more you're familiar with.

It's possible to write VIEWs, which are essentially a way not to write
queries over and over again manually.
http://www.postgresql.org/docs/current/static/sql-createview.html

Next step up would probably be functions in SQL, which are a lot like
VIEWs, only they can take parameters. As SQL is Turing complete,
functions in SQL can do quite a lot.
http://www.postgresql.org/docs/current/static/xfunc-sql.html

Then there's trigger functions and the associated triggers.
http://www.postgresql.org/docs/current/static/triggers.html

You can keep going from there, up to and including using PostgreSQL
components in some other system :)

> >    I am a total newbie to this and will need to learn from scratch....
> >
> >     Would appreciate the help a lot....

This list is one good place to get help. Another is the IRC channel
on freenode

irc://irc.freenode.net/postgresql

> > Machiel
>
> RTFM
>
> http://www.postgresql.org/docs/8.4/interactive/xplang.html

As The Fine Manual is very extensive, telling people just to Read it
from some arbitrary point is just barely more helpful than not
specifying one, i.e. not terribly. Perhaps asking a few more
questions would be. :)

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2010-08-04 14:03:26 killing idle attaches without killing others
Previous Message Jay Flattery 2010-08-04 13:00:56 hashtable issue - HASH_FIND??