SQLite Forum

Returning and insert with conflict
Login
Yes, I could add an SELECT before every INSERT but that would increase the complexity of code. Maybe a CTE is working.

WITH cte(rowid) AS (INSERT OR IGNORE INTO my_table(foo) VALUES (?) RETURNING rowid UNION ALL  SELECT rowid FROM mytable WHERE foo = ?)
SELECT rowid FROM cte

But I am not sure you can even do that. Anyway in this case I would go for the dummy column because the code would be more readable.