Re: kinda newbie - ish question

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: kinda newbie - ish question
Дата
Msg-id m3lmij5kk6.fsf@belphigor.mcnaught.org
обсуждение исходный текст
Ответ на kinda newbie - ish question  (mmacie@earthlink.net (Mike Judkins))
Список 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 по дате отправления:

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: Problem : Pound to Hash sign
Следующее
От: Marko Kreen
Дата:
Сообщение: Re: kinda newbie - ish question