[sqlite] drop table if link view error pragma_table_info view
Hello If you delete a table that is associated with a view. An error occurs when calling pragma_table_info Example: CREATE TABLE COMPANY( ID INT PRIMARY KEY NOT NULL, NAME TEXTNOT NULL, AGEINT NOT NULL, ADDRESSCHAR(50), SALARY REAL ); CREATE VIEW COMPANY_VIEW AS SELECT ID, NAME, AGE FROM COMPANY; DROP table 'COMPANY'; pragma table_info('COMPANY_VIEW'); Error: Uncaught Error: no such table: main.COMPANY As an option to automatically destroy all connected VIEW -- Best regards, Kirill mailto:kir...@aidagw.com ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug: sqlite ARM endian problem
On Mon, May 20, 2019 at 02:46:47PM -0400, Richard Hipp wrote: > On 5/20/19, Sebastian Kemper wrote: > > In OpenWrt's forum a user raised a topic about being unable to use > > Asterisk on his armeb xscale device. > > Please download a tarball of the latest trunk version of SQLite > (check-in https://www.sqlite.org/src/info/b7aad929619f7043 or later) > and verify that it now works on OpenWrt armeb xscale devices and > report back, as we have no way of verifying this ourselves. Thanks. Will do. Please allow a day or two to get back to you. Kind regards, Seb > -- > D. Richard Hipp > d...@sqlite.org ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug: sqlite ARM endian problem
On 5/20/19, Sebastian Kemper wrote: > In OpenWrt's forum a user raised a topic about being unable to use > Asterisk on his armeb xscale device. Please download a tarball of the latest trunk version of SQLite (check-in https://www.sqlite.org/src/info/b7aad929619f7043 or later) and verify that it now works on OpenWrt armeb xscale devices and report back, as we have no way of verifying this ourselves. Thanks. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Bug: sqlite ARM endian problem
Hello list, In OpenWrt's forum a user raised a topic about being unable to use Asterisk on his armeb xscale device. We narrowed it down to sqlite. Asterisk was unable to insert a simple table. Couldn't prepare statement 'CREATE TABLE IF NOT EXISTS astdb(key VARCHAR(256), value VARCHAR(256), PRIMARY KEY(key))': malformed database schema (?) Couldn't create astdb table: malformed database schema (?) ASTdb initialization failed. ASTERISK EXITING! The user added that the last working version is from years ago (OpenWrt Barrier Breaker, sqlite 3.8.7.4). I don't have access to xscale armeb hardware so I ended up using qemu-armeb. 3.8.7.4 was indeed working. I did a git bisect between that version and 3.12.0 (can't really recall why I picked 3.12.0). I ended up with this: 329428e2088aabb1db2dc6e48108b76551405a8e is the first bad commit commit 329428e2088aabb1db2dc6e48108b76551405a8e Author: drh Date: Tue Jun 30 13:28:18 2015 + Remove the use of htonl() in the previous check-in due to linkage issues. Add the get2byteAligned() macro and use it for access to the cell offsets on btree pages for about a 1% performance gain. FossilOrigin-Name: 79ff36b7170c9e7e7a9935c8b9d1665867771087 :100644 100644 a786e15afe8632e66350667d25015afd3b8b6a9a cfb68a89fa85fc5a367d2fdf967a5b222aeab3dc M manifest :100644 100644 e1a76f6457307e3aa2d3f97a71d81b00aa71e288 0e8e09954965f5d56a6285b6b9c9cbf6a5f8e5a3 M manifest.uuid :04 04 192f172deef1f2c552740c6cca11f2757b78f036 575334b08e6514e2941915a9d7dd5c780e251287 M src That commit added get2byteAligned(). And then I saw this: #ifndef SQLITE_BYTEORDER # if defined(i386) || defined(__i386__) || defined(_M_IX86) ||\ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) ||\ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) ||\ defined(__arm__) || defined(_M_ARM64) # define SQLITE_BYTEORDER1234 # elif defined(sparc)|| defined(__ppc__) # define SQLITE_BYTEORDER4321 # else # define SQLITE_BYTEORDER 0 # endif #endif So for everything where the compiler defines __arm__ little endian is assumed. Why did this work out before? - Because the other macros that get used when "SQLITE_BYTEORDER" is "1234" are accessing 4 Byte. And armeb is able to deal with that (see https://en.wikipedia.org/wiki/Endianness#Bi-endianness). But for 2 Bytes (get2byteAligned!) this doesn't work. At first we just removed "defined(__arm__)" and this worked out fine. But I think it'd be better to replace it with: #if defined (__ARMEB__) || (__AARCH64EB__) for BE and #if define (__ARMEL__) || (__AARCH64EL__) for LE. There are other macros that could be used, of course (see https://sourceforge.net/p/predef/wiki/Endianness/ for a list of them). But I don't want to hang my head too far out of the window :) The "_M_ARM" and "_M_ARM64" macros seem to be from MS VS. So there the ARM generalization could also cause problems, but I don't know what other macros they have there. Do you agree with the above? Do you want me to send a patch? Kind regards, Seb ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Segmentation fault can result from setting error message parameter to NULL when calling sqlite3session_diff
Hello, We have found a minor bug in the session extension. The problem can occur in sqlite3session_diff, when there is a table schema mismatch, if no error pointer is provided. According to the documentation of sqlite3session_diff: > ** If the operation successful, SQLITE_OK is returned. Otherwise, an SQLite > ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg > ** may be set to point to a buffer containing an English language error > ** message... If an application calls sqlite3session_diff and encounters a schema mismatch error, while having provided NULL for the pzErrMsg parameter, a segmentation fault occurs. We believe this is caused here, in sqlite3session.c: L#1627 if( bMismatch ){ *pzErrMsg = sqlite3_mprintf("table schemas do not match"); rc = SQLITE_SCHEMA; } There is no check that pzErrMsg is not NULL here prior to assignment. There's an easy work-around: providing a pzErrMsg out parameter when calling sqlite3session_diff resolves the crash. Cheers, Micah ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] readfile() enhancement request
Rowan Worth, on Monday, May 20, 2019 03:02 AM, wrote... >On Sat, 18 May 2019 at 00:34, Tony Papadimitriou wrote: > >> It’s quite often (for me, at least) the case I need to do something like >> this from the command line: >> >> >sqlite3.exe my.db “insert into t values(‘simple field’,’multi-line text >> copied from some other app’) >> >> The problem is the multi-line text cannot be copy-pasted directly into the >> command line as the first newline will terminate the command. So, I’ve >> been using readline() like so: >> > >I haven't tested on windows, but FWIW the interactive sqlite3 shell has no >such limitation - statements are free to span multiple lines. ie. you can >type: > > sqlite> INSERT INTO T VALUES('simple field', '«paste- > ...> multi-line- > ...> content»') > ...> ; > >I guess you'd also prefer to not have to type out the full INSERT statement >each time, but this kind of seems like a shell problem more than an sqlite >problem! The only problem with this, and some of the previous copy and paste ideas is that if there is a single quote (') in that pasted data, it can mess up the data. If you know that there is not going to be a ' in there, you're ok. Otherwise, I have been bitten by this a few times, where I have to do more work than necessary. Just my $US 0.02. Thanks. josé ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] readfile() enhancement request
On Sat, 18 May 2019 at 00:34, Tony Papadimitriou wrote: > It’s quite often (for me, at least) the case I need to do something like > this from the command line: > > >sqlite3.exe my.db “insert into t values(‘simple field’,’multi-line text > copied from some other app’) > > The problem is the multi-line text cannot be copy-pasted directly into the > command line as the first newline will terminate the command. So, I’ve > been using readline() like so: > I haven't tested on windows, but FWIW the interactive sqlite3 shell has no such limitation - statements are free to span multiple lines. ie. you can type: sqlite> INSERT INTO T VALUES('simple field', '«paste- ...> multi-line- ...> content»') ...> ; I guess you'd also prefer to not have to type out the full INSERT statement each time, but this kind of seems like a shell problem more than an sqlite problem! -Rowan ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users