Re: Sequence value

From: "Esa Pikkarainen" <epikkara(at)ktk(dot)oulu(dot)fi>
To: Alessio Bragadini <alessio(at)albourne(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sequence value
Date: 2000-12-15 12:14:45
Message-ID: 2BA05130524@ktk.oulu.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you,
Yet another way to do it ;-)
but unfortunately it did not solve my problem. Now I have no access
to the value of nextval('koe_pkey_id'). This query does not return
any recordset.
Is it possible to embed Insert query as a subquery into a Select
query? I have not managed to dot it. I mean something like:

SELECT nextval('koe_pkey_id') as val, (INSERT INTO koe (id, name)
values (val, 'uusi')) as dummy FROM koe;"

That would both insert new record and return serial value - if it
just worked...

Thanks
Esa

Alessio Bragadini wrote (15 Dec 00,):
> Esa Pikkarainen wrote:
> > SQL ="SELECT nextval('koe_pkey_id') as val;
> > INSERT INTO koe (id, name) values (val, 'uusi');"

> INSERT INTO koe (id, name) (SELECT nextval('koe_pkey_id'), 'uusi');

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alessio Bragadini 2000-12-15 12:32:44 Re: Sequence value
Previous Message Oleg Bartunov 2000-12-15 12:08:26 Re: index support for arrays (GiST)