Re: Get last generated serial sequence and set it up when explicit value is used

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Get last generated serial sequence and set it up when explicit value is used
Дата
Msg-id CAKFQuwZeof4FQOuNH5hu7=ci+x+vAai3JfBQye15Dvs_nB7deg@mail.gmail.com
обсуждение исходный текст
Ответ на Get last generated serial sequence and set it up when explicit value is used  (Sebastien FLAESCH <sf@4js.com>)
Ответы Re: Get last generated serial sequence and set it up when explicit value is used  (Sebastien FLAESCH <sf@4js.com>)
Список pgsql-sql
On Thu, Nov 19, 2020 at 12:21 PM Sebastien FLAESCH <sf@4js.com> wrote:
Is this ok

subjective; I find it confusing.
 
/ legal

expect that the system will tell you if what you are doing is illegal.
 
/ without risk? (when multiple users insert rows at the same time?)

add a unique index and it will be risk free - and you will see whether the rate of errors is acceptable for you.

Seems if you are going to allow direct inserts though you should test multiple inserted rows at a time, not just single-row.

I'd suggest using the newer GENERATED ALWAYS feature and prohibiting direct specification of values for the sequence-backed column.

David J.

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

Предыдущее
От: Sebastien FLAESCH
Дата:
Сообщение: Get last generated serial sequence and set it up when explicit value is used
Следующее
От: Sebastien FLAESCH
Дата:
Сообщение: Re: Get last generated serial sequence and set it up when explicit value is used