pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Luis Sousa <llsousa@ualg.pt>
Cc: Robert Treat <xzilla@users.sourceforge.net>
Cc: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Permission on insert rules
Date: Wed, 13 Nov 2002 13:52:19 -0600
Message-ID: <20021113195219.GA10480@wolff.to> (raw)
In-Reply-To: <3DD22D03.4090505@ualg.pt>
References: <web-1822655@davinci.ethosmedia.com>
	<1037137215.27220.64.camel@camel>
	<3DD22D03.4090505@ualg.pt>

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.



view thread (16+ messages)

Message-ID: <20021113195219.GA10480@wolff.to>
Permalink:  ../20021113195219.GA10480@wolff.to/
Also on:    postgresql.org/message-id/20021113195219.GA10480@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, llsousa@ualg.pt, xzilla@users.sourceforge.net, josh@agliodbs.com
  Subject: Re: Permission on insert rules
  In-Reply-To: <20021113195219.GA10480@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox