-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read-only mode #34
Comments
Hi, It is possible to connect sqlite using read-only database file. $ sqlite3 /tmp/test.db sqlite> CREATE TABLE t1(a int primary key, b text); sqlite> INSERT INTO t1 VALUES (0, 'test'); sqlite> SELECT * FROM t1; 0|test sqlite>.q $ chmod a-w /tmp/test.db $ psql # CREATE EXTENSION sqlite_fdw; # CREATE SERVER sqlite_testdb FOREIGN DATA WRAPPER sqlite_fdw OPTIONS (database '/tmp/test.db'); # IMPORT FOREIGN SCHEMA public FROM SERVER sqlite_testdb INTO public; # SELECT * FROM t1; SELECT * FROM t1; a | b ---+------ 0 | test (1 row) # INSERT INTO t1 VALUES (1, 'new'); INSERT INTO t1 VALUES (1, 'new'); ERROR: failed to execute remote SQL: rc=8 attempt to write a readonly database sql=INSERT INTO main."t1"(`a`, `b`) VALUES (?, ?) |
Thanks for the answer. there is a second process writing to sqlite db. As long as they can work together by just setting up file permissions this the solution. I think I need to remove write permission only from postgres user. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to connect sqlite in read-only mode?
The text was updated successfully, but these errors were encountered: