Thread: Postgresql database procedures?

Postgresql database procedures?

From
Machiel Richards
Date:
Good day all

      I am looking for some info / resources where I can learn how to write database procedures, functions,etc?

   I am a total newbie to this and will need to learn from scratch....

    Would appreciate the help a lot....


Machiel

Re: Postgresql database procedures?

From
zhong ming wu
Date:
On Wed, Aug 4, 2010 at 7:32 AM, Machiel Richards <machielr@rdc.co.za> wrote:
> Good day all
>
>       I am looking for some info / resources where I can learn how to write
> database procedures, functions,etc?
>
>    I am a total newbie to this and will need to learn from scratch....
>
>     Would appreciate the help a lot....
>
>
> Machiel
>
>

RTFM

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

Re: Postgresql database procedures?

From
Raymond O'Donnell
Date:
On 04/08/2010 12:32, Machiel Richards wrote:
> Good day all
>
> I am looking for some info / resources where I can learn how to write
> database procedures, functions,etc?
>
> I am a total newbie to this and will need to learn from scratch....
>
> Would appreciate the help a lot....


Hi there,

The manual is a good place to start:

   http://www.postgresql.org/docs/8.4/static/plpgsql.html

After that, do come back and ask questions, and people here will be glad
to help.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

Re: Postgresql database procedures?

From
Raymond O'Donnell
Date:
On 04/08/2010 12:55, Raymond O'Donnell wrote:
> On 04/08/2010 12:32, Machiel Richards wrote:
>> Good day all
>>
>> I am looking for some info / resources where I can learn how to write
>> database procedures, functions,etc?
>>
>> I am a total newbie to this and will need to learn from scratch....
>>
>> Would appreciate the help a lot....
>
>
> Hi there,
>
> The manual is a good place to start:
>
> http://www.postgresql.org/docs/8.4/static/plpgsql.html
>
> After that, do come back and ask questions, and people here will be glad
> to help.

Another place worth looking is the "Snippets" section of the PostgreSQL
wiki:

   http://wiki.postgresql.org/wiki/Category:Snippets

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

Re: Postgresql database procedures?

From
David Fetter
Date:
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@rdc.co.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@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.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