| From: | "Peter J(dot) Schoenster" <borg(at)errorcode(dot)com> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: [SQL] Is this possible? |
| Date: | 2001-05-15 23:47:10 |
| Message-ID: | 3B016B9E.17125.A6AD29A@localhost |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice pgsql-sql |
On 11 May 2001, at 11:24, Roberto Mello wrote:
> On Tue, May 08, 2001 at 09:16:56PM -0400, Wei Weng wrote:
> > I have a table that has a serial for primary key. Is it possible to
> > get the new available primary key right after I insert a row of new
> > entry?
>
> Yeah. Se the documentation on triggers.
My method is to insert into the target table(s) in advance.
my ($job_id) = $self->{dbh}->selectrow_array(qq|SELECT
NEXTVAL ('zipinfo_job_id_seq')|);
and then I use job_id as a hidden value in the form that gets printed.
Peter
---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
-- Philip K. Dick
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Armin Rauch | 2001-05-16 09:08:17 | Problem compiling PostgreSQL 7.1.1 on SUSE Linux 7.1 |
| Previous Message | Matus "fantomas" Uhlar | 2001-05-15 12:48:21 | asynchronour queries and result testing |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Per-Olof Pettersson | 2001-05-15 23:51:46 | Re: how to remove ? |
| Previous Message | Per-Olof Pettersson | 2001-05-15 23:38:22 | Re: How NULL is interpreted in Pgsql |