Re: kinda newbie - ish question - Mailing list pgsql-general

From Marko Kreen
Subject Re: kinda newbie - ish question
Date
Msg-id 20011011002406.A18573@l-t.ee
Whole thread Raw
In response to kinda newbie - ish question  (mmacie@earthlink.net (Mike Judkins))
List pgsql-general
On Mon, Oct 08, 2001 at 07:31:36PM -0700, Mike Judkins wrote:
> Im trying to insert a record with a php script. I insert a NULL value
> to get my auto increment unique key to automatically populate as
> usual. Then I want to be able to insert another value in this same row
> which is a URL. This URL is basically a path plus a filename which I
> want to have the exact same name as the unique key that was just
> generated for the row. Is there a quick way is SQL to do this or will
> I have to handle it in my script?

update tbl set fn = fileprefix || currval('tbl_id_seq')
    where id = currval('tbl_id_seq')

This must be in the same TX as first insert.

--
marko


pgsql-general by date:

Previous
From: Doug McNaught
Date:
Subject: Re: kinda newbie - ish question
Next
From: "H. Wade Minter"
Date:
Subject: Re: Where to count