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

From Doug McNaught
Subject Re: kinda newbie - ish question
Date
Msg-id m3lmij5kk6.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to kinda newbie - ish question  (mmacie@earthlink.net (Mike Judkins))
List pgsql-general
mmacie@earthlink.net (Mike Judkins) writes:


> 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?

Why not leave the unique ID part out of the stored URL and then
combine them when you fetch from the DB?  It would be something like

SELECT urlprefix || id::text FROM mytable WHERE <whatever>

(That's assuming the ID is non-text, like a SERIAL)

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

pgsql-general by date:

Previous
From: Doug McNaught
Date:
Subject: Re: Problem : Pound to Hash sign
Next
From: Marko Kreen
Date:
Subject: Re: kinda newbie - ish question