Re: kinda newbie - ish question

From: Marko Kreen <marko(at)l-t(dot)ee>
To: Mike Judkins <mmacie(at)earthlink(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: kinda newbie - ish question
Date: 2001-10-10 22:24:06
Message-ID: 20011011002406.A18573@l-t.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thalis A. Kalfigopoulos 2001-10-10 23:15:45 Re: triggers
Previous Message Doug McNaught 2001-10-10 22:06:00 Re: database field "pointer"