Re: Permission on insert rules - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: Permission on insert rules
Date
Msg-id 20021113195219.GA10480@wolff.to
Whole thread Raw
In response to Re: Permission on insert rules  (Luis Sousa <llsousa@ualg.pt>)
List pgsql-sql
On Wed, Nov 13, 2002 at 10:44:19 +0000, Luis Sousa <llsousa@ualg.pt> wrote:
> 
> I have a table, whose primary key is a serial, that is connected to a 
> few tables. In this view, I want to insert data,  in the main table, and 
> also in the "child" tables. My idea was to create a rule, that first 
> inserts in the parent table, and some functions, that will select the 
> parent table returning the id created, and will insert some data on 
> child table (I'm open for sugestions to do this !!!). I don't know 
> exactly how this works if more than one user at the same time !!!!

You can use currval to retrieve the last value assigned to a specified
sequence in the current session. This is transaction safe.


pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Permission on insert rules
Next
From: "Pedro Igor Craveiro e Silva"
Date:
Subject: System´s database table