Detect multiple auto increment or primary key columns on table creation #8

Open
opened 2026-09-07 16:51:56 +02:00 by c.fahner · 2 comments
Owner

Currently the implementation only checks for duplicate primary keys (or auto increments) during table alteration in Database::enforceSchema(). The implementation should also prevent this situation during table creation.

Currently the implementation only checks for duplicate primary keys (or auto increments) during table alteration in `Database::enforceSchema()`. The implementation should also prevent this situation during table creation.
c.fahner added this to the v0.1 milestone 2026-09-07 16:51:56 +02:00
Author
Owner

Actually, the driver will already throw an exception in this situation so the implementation does not need to duplicate that effort.

The checks do need to stay in the ALTER TABLE variant, since it consists of sequential queries. The first queries should not be applied if one of the later ones is guaranteed to fail.

This reasoning should be added as a comment to the method that performs the CREATE TABLE query.

Actually, the driver will already throw an exception in this situation so the implementation does not need to duplicate that effort. The checks do need to stay in the ALTER TABLE variant, since it consists of sequential queries. The first queries should not be applied if one of the later ones is guaranteed to fail. This reasoning should be added as a comment to the method that performs the CREATE TABLE query.
c.fahner modified the milestone from v0.1 to v0.2 2026-09-10 15:21:42 +02:00
Author
Owner

Changed my mind again. In the bigger picture it wastes less compute to catch this error before it has to go through a socket and parsed by a separate application.

Changed my mind again. In the bigger picture it wastes less compute to catch this error before it has to go through a socket and parsed by a separate application.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
slendium/ocd-mariadb#8
No description provided.