Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 00F99474E61 for ; Wed, 20 Nov 2002 11:45:39 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 25362474E5C for ; Wed, 20 Nov 2002 11:45:36 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1834137; Wed, 20 Nov 2002 08:49:50 -0800 From: "Josh Berkus" Subject: Re: trying to learn plpqsql... so please forgive.. To: Michiel Lange , pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Wed, 20 Nov 2002 08:49:50 -0800 Message-ID: In-Reply-To: <5.1.0.14.0.20021120010436.00b4c920@192.168.1.3> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/313 X-Sequence-Number: 10455 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 VALUES ' > 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 INSERT trigger can modify the inserted data, or reject it, or update 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