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.