Re: Permission on insert rules

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Luis Sousa <llsousa(at)ualg(dot)pt>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Permission on insert rules
Date: 2002-11-13 19:52:19
Message-ID: 20021113195219.GA10480@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Nov 13, 2002 at 10:44:19 +0000,
Luis Sousa <llsousa(at)ualg(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-11-13 20:06:35 Re: System´s database table
Previous Message Josh Berkus 2002-11-13 17:29:46 Re: Permission on insert rules