Re: Can I do this?

Поиск
Список
Период
Сортировка
От Michael Nolan
Тема Re: Can I do this?
Дата
Msg-id CAOzAquKmW1jw11nQH7_sd+F5PWRZFLW5kSaHUHMNoMABjb_Z0Q@mail.gmail.com
обсуждение исходный текст
Ответ на Can I do this?  (stan <stanb@panix.com>)
Ответы Re: Can I do this?
Список pgsql-general


On Thu, Jan 16, 2020 at 6:28 AM stan <stanb@panix.com> wrote:
I am trying to create a function to automatically create a reference value
when a record is inserted into a table. I want the reference value to
consist of the user that is doing the insert, plus a couple of dates, plus
a sequence number, where the sequence number will increment every time a
given user inserts a record. because this sequence number is user specific,
my first  thought is not to use a set of sequences for it, but to do this by
selecting the maximum sequence number that user has entered in the past.

What happens if two transactions by/for the same user are committed at around the same point in time?  The advantage of sequences is they're guaranteed to be unique, I'm not sure counting the number of previous records and adding one will always assure that.
--
Mike Nolan

В списке pgsql-general по дате отправления:

Предыдущее
От: Justin
Дата:
Сообщение: Re: Can I drop a NOT NUL constrain on an existing table?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Is there a GoTo ?