Re: Automatic PK values not added to new rows

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Automatic PK values not added to new rows
Дата
Msg-id 6d67d16b-7cdd-2f40-9ebe-82a499eb11c2@gmx.net
обсуждение исходный текст
Ответ на Re: Automatic PK values not added to new rows  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Automatic PK values not added to new rows
Список pgsql-general
Rich Shepard schrieb am 25.05.2022 um 20:15:
> On Wed, 25 May 2022, Adrian Klaver wrote:
>
>> Do:
>> select * from people_person_nbr_seq;
>> and report back the results.
>
> Adrian,
>
> Huh!
> bustrac=# select * from people_person_nbr_seq;
>   last_value | log_cnt | is_called ------------+---------+-----------
>          683 |      32 | t
> (1 row)
>
> It's out of sync with
>   select max(person_nbr) from people;
>
> Is there a way for me to synchronize the two?


If you want to prevent such a situation in the future, you might want to
consider defining those columns as "generated always as identity" instead
of "serial".

Then you'd get an error if you try to bypass the database generated values.




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

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Re: Automatic PK values not added to new rows [RESOLVED]
Следующее
От: Abhishek Bhola
Дата:
Сообщение: Re: PG 13.6 : Data corruption error message not being sent to syslog