pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: MaurĂ­cio Sessue Otta <mauricio@cristorei.com.br>
To: pgsql-sql@postgresql.org
Subject: Getting sequence value after inserting many rows at a time
Date: Thu, 9 Jan 2003 22:48:11 -0200
Message-ID: <010901c2b841$f429f290$830101c0@mauricio1> (raw)

Hi,

I have a PHP script that do something like this:

INSERT INTO table_with_sequence (field1, field2...., fieldn) 
SELECT field1, field2, ..., fieldn FROM table,table 
WHERE condition, condition

My doubt:
Will the rows just inserted in "table_with_sequence" always be sequencial?
(won't it happen to have X rows from this INSERT, 1 rows from another INSERT
in the middle and the rest rows of the first INSERT?)

How can I safely get the first value the INSERT "generated" for 
the sequence?

[]'s Mauricio

view thread (3+ messages)  latest in thread

Message-ID: <010901c2b841$f429f290$830101c0@mauricio1>
Permalink:  ../010901c2b841$f429f290$830101c0@mauricio1/
Also on:    postgresql.org/message-id/010901c2b841$f429f290$830101c0@mauricio1

 · 

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: mauricio@cristorei.com.br
  Subject: Re: Getting sequence value after inserting many rows at a time
  In-Reply-To: <010901c2b841$f429f290$830101c0@mauricio1>

* 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