Похожие чаты

In postgres if i have "id SERIAL PRIMARY KEY" and

some other VARCHAR UNIQUE NOT NULL data. why does the id keep incrementing when i try to add some non unique piece of data. would it be possible to make it so that the id would only increment when all the conditions have been met to even be able to add another row to the table?

6 ответов

17 просмотров

Why should auto-increment care about other columns?

kusti420- Автор вопроса

it shouldnt? idk i just didnt expect it to behave like that. so its completely normal for it to increment even when it cant add a new row?

kusti420- Автор вопроса
Thomas
wut it really skips ids sometimes?

yeah if u have some conditions for what data each row should have and if u try to add sth where these conditions arent met it takes up that id and it could never be used again

kusti420
yeah if u have some conditions for what data each ...

Conditions as in normal table constraints?

kusti420- Автор вопроса

Похожие вопросы

Обсуждают сегодня

Карта сайта