Re: trying to learn plpqsql... so please forgive.. - Mailing list pgsql-sql

From Josh Berkus
Subject Re: trying to learn plpqsql... so please forgive..
Date
Msg-id web-1834137@davinci.ethosmedia.com
Whole thread Raw
In response to trying to learn plpqsql... so please forgive..  (Michiel Lange <michiel@minas.demon.nl>)
Responses Re: trying to learn plpqsql... so please forgive..  (Michiel Lange <michiel@minas.demon.nl>)
List pgsql-sql
Michiel,

> Maybe this should be sent to novice... I was not certain, but if it
> should, please tell me so.

No need to apologise.   Novice would have been appropriate, but SQL is
OK too.

> When I do an 'INSERT INTO <table> VALUES <row1,row2,row3>'
> and on the table is a serial primary key named p_key.
> As I want this number to be auto-generated, but use it as a 'customer
> number', I want to create this function to return the value of this
> insert. I thought/hoped that this would work, but as there are some
> people dependant on this database, I dare not try out too much ;-)
> This would be the first time I used plpgsql, so I am not so certain
> about what I do.

Hmmm ... the trigger, as you've written it, won't work.   An INSERTtrigger can modify the inserted data, or reject it,
orupdate data in
 
other tables.  But it cannot return data to the screen.

Can you break down, in more detail, what you're *trying* to do?   It
can probably be done, but I'm still not clear on what you're
attempting.

-Josh Berkus



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems invoking psql. Help please.
Next
From: Oliver Elphick
Date:
Subject: Re: Problems invoking psql. Help please.