5 ms·
In what cases is it unwise to rely on rowid over a id field?
by Boltgolt 3y ago
In what cases is it unwise to rely on rowid over a id field?
- gorgoiler 3y agoI don’t think there are any. They are one and the same — if you create an integer primary key named id it is aliased to rowid: https://www.sqlite.org/rowidtable.html https://www.sqlite.org/rowidtable.html
- Scaevolus 3y agoThis is safer-- relying on implicit rowids can break things if you use a plaintext database dump (those don't have rowids), and having a column "id integer primary key" is clearer in the schema.
- eternauta3k 3y agoI think the integer autoincrement primary key is more explicit / less mysterious than the implicit rowid. Even if most of us have run into that explanation in the sqlite manual.