logoalt Hacker News

groundzeros2015today at 5:07 AM1 replyview on HN

For example you can’t insert or update a SQLite view.

I don’t even think SQLite lets you fully update a table schema.

If you start trying to use it for sql and not just storing rows you run into these everywhere. SQLite is not serving the same needs as Postgres.


Replies

bbkanetoday at 12:53 PM

You can use a trigger with INSTEAD OF to update a view:

CREATE TRIGGER update_customer_emails_trigger INSTEAD OF UPDATE ON customer_emails BEGIN UPDATE customers SET email = new.email, name = new.name WHERE id = old.id; END;

Maybe that's not as flexible as you need.

SQLites process for table updates can be pretty onerous if their ALTER TABLE lacks support. Its a 12 step process the docs have the temerity to call "simple" instead of "tedious and risky" - https://www.sqlite.org/lang_altertable.html#otheralter