Re: Table partitioning with sequence field in postgresql12

Поиск
Список
Период
Сортировка
От Tim Cross
Тема Re: Table partitioning with sequence field in postgresql12
Дата
Msg-id 87tuz8zw7u.fsf@gmail.com
обсуждение исходный текст
Ответ на Re: Table partitioning with sequence field in postgresql12  (Srinivasa T N <seenutn@gmail.com>)
Список pgsql-general
Srinivasa T N <seenutn@gmail.com> writes:

> Hi,
>    I have a parent table with one of the field as ""gid" int4 DEFAULT
> nextval('"ami_smart_new".aoi_boundary_gid_seq'::regclass)".
>
>    I create child tables which inherit parent and use hash partition.  When
> I directly insert into child tables, will there be any race condition
> causing two child tables getting the same sequence value for gid?
>
Assuming all inserts use the default e.g. nextval from the same
sequence, you won't get duplicates. You could get a duplicate if an
insert sets an explicit value for gid of course or if rows in any table
were inserted with a gid which was not obtained from the same sequence
using nextval i.e. parent and children use same sequence. The sequence
is just a counter with the property that no two calls to nextval from
that sequence will have the same value. You cannot make any additional
assumptions e.g. cannot assume gid values will be inserted in order or
there won't be 'gaps ' etc.
-- 
Tim Cross



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

Предыдущее
От: Toomas Kristin
Дата:
Сообщение: Re: Conflict with recovery on PG version 11.6
Следующее
От: Matthias Apitz
Дата:
Сообщение: Re: ESQL/C no indicator variables ./. error -213