Re: [sqlite] is this possible
From the page https://sqlite.org/lang_createview.html : "The CREATE VIEW command assigns a name to a pre-packaged SELECT statement ..." So, it seems that the command "CREATE VIEW" just creates a name for a SELECT statement, and checks nothing more than syntax. On 28.3.2019 21:21, Mark Wagner wrote: CREATE VIEW v as select * from t join s on (foo = q); ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to refer to `this` table?
Try creating a trigger(https://sqlite.org/lang_createtrigger.html) instead of the constraint "noCircularRef_when the table already exists. On 23.2.2019 8:43, Rocky Ji wrote: If I do CREATE TABLE Sample ( id INTEGER PRIMARY KEY AUTOINCREMENT, parent_id INTEGER, CONSTRAINT p FOREIGN KEY (parent_id) REFERENCES Sample (id) ); I don't get any errors and the schema behaves as expected. But if I try CREATE TABLE Aliases ( alias_id INTEGER PRIMARY KEY AUTOINCREMENT, real_name TEXT NOT NULL, aka TEXT NOT NULL, CONSTRAINT xyz UNIQUE (real_name, aka), CONSTRAINT noCircularRef_A CHECK ( real_name NOT IN (SELECT aka FROM Aliases) ), CONSTRAINT noCircularRef_B CHECK ( aka NOT IN (SELECT real_name FROM Aliases) ) ); I am getting an `Error: no such table: Aliases` error. So how do I implement this constraint? Are there any special keywords, like NEW and OLD of trigger statements, to refer to current table? ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to backup a memory database to a memory stream?
Is "sqlite3_serialize" (https://sqlite.org/c3ref/serialize.html) helpful? On 22.2.2019 8:57, heribert wrote: Is there any way to backup a memory database directly to a memory stream? In my case i have to backup a small memory database directly into a byte array, without using any os based temp file. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] why no unique columns on alter table
Probably because altering a table is done by changing the value of column SQL in table 'sqlite_master'. Adding a unique constraint requires value checks. On 12.2.2019 6:15, Mark Wagner wrote: This is mainly for my curiosity. Is there any particular reason that one can't add a unique column on an alter table? With a default value of null they would all have unique values by default. Any insight into this would be great. Perhaps there' something obvious I'm missing. -- Mark ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users