SQLite Forum

Non primary key alias to rowid
Login
First I need the ROWID for the update hook. Second I need the PRIMARY KEY of a text field for the sessions. Third I need an integer id for efficiency in the child table because the PRIMARY KEY in the parent table is large. Then I cannot use ROWID for it because it is unstable and does not work together with the FOREIGN KEYS. So I think what I really need is an alias of ROWID which is not a PRIMARY KEY. Like you see in this examples I have an extra unique index which could be an alias to ROWID but this is impossible because I use already an other
PRIMARY KEY. I am not an expert in Sqlite, so maybe somebody knows a better way.

CREATE TABLE IF NOT EXISTS translatables(id INTEGER NOT NULL UNIQUE, translationTextId TEXT PRIMARY KEY NOT NULL CHECK (translationTextId != ''), screenId TEXT, defaultText TEXT)

CREATE TABLE IF NOT EXISTS translations(id INTEGER NOT NULL UNIQUE, 
translatableId INTEGER NOT NULL REFERENCES translatables(id) ON DELETE 
CASCADE, language TEXT NOT NULL CHECK (language != ''), translation 
TEXT, PRIMARY KEY(translatableId, language))