Re: [sqlite] Logging sqlite executed/bound SQL statements

2019-02-13 Thread Marek Sebera
What I did the shim for, was Linux system (x86/x86-64) and libsqlite3.so.0 version 3.26/3.27 Not logging API calls, but logging executed SQL statements (something mysql/maria/postgre/oracle/... provide in form of query-log) My main interest was to inspect SQL statements executed by 3rd party

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread J. King
On February 13, 2019 5:47:09 PM EST, Thomas Kurz wrote: >I don't think so because this works (shortened here; it also works with >REFERENCES...): > >ALTER TABLE test ADD COLUMN groupid2 INTEGER NOT NULL DEFAULT 1; You're correct; I must have been confusing the prohibition on CURRENT_TIMESTAMP

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Keith Medcalf
You should probably read the documentation. https://sqlite.org/lang_altertable.html --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users-

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Graham Holden
On Wednesday, February 13, 2019, 11:06:07 PM, Thomas Kurz wrote: >> I guess a missing DEFAULT automatically implies DEFAULT NULL, so >> the behavior of ALTER should be correct whilst CREATE seems to >> forget to reject the statement. I suspect the difference is you can CREATE a NOT NULL column

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Thomas Kurz
> I guess a missing DEFAULT automatically implies DEFAULT NULL, so the behavior > of ALTER should be correct whilst CREATE seems to forget to reject the > statement. Sorry, I was wrong about this. The CREATE shows the correct behavior whereas ALTER incorrecty rejects the statement. According

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Thomas Kurz
> This is a limitation of SQLite's current ALTER TABLE implementation. Columns > can only be added with a default value of NULL, therefore NOT NULL columns > are forbidden. I don't think so because this works (shortened here; it also works with REFERENCES...): ALTER TABLE test ADD COLUMN

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread J. King
On February 13, 2019 5:32:09 PM EST, Thomas Kurz wrote: >I just stumbled upon the following issue (tested with 3.27.1): > >I can do this: >CREATE TABLE test (groupid INTEGER NOT NULL REFERENCES mygroup (id) ON >UPDATE CASCADE ON DELETE CASCADE); > >But this fails: >ALTER TABLE test ADD COLUMN

[sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Thomas Kurz
I just stumbled upon the following issue (tested with 3.27.1): I can do this: CREATE TABLE test (groupid INTEGER NOT NULL REFERENCES mygroup (id) ON UPDATE CASCADE ON DELETE CASCADE); But this fails: ALTER TABLE test ADD COLUMN groupid2 INTEGER NOT NULL REFERENCES mygroup (id) ON UPDATE

Re: [sqlite] Logging sqlite executed/bound SQL statements

2019-02-13 Thread Warren Young
On Feb 13, 2019, at 2:10 PM, Marek Sebera wrote: > > re-compiling system provided library is not an option What version and system are we talking about? It matters greatly. If we’re talking about the epochal 3.7.x series, the answers are very different than if we’re talking about a version

[sqlite] Logging sqlite executed/bound SQL statements

2019-02-13 Thread Marek Sebera
Hello, is there any better way, if re-compiling system provided library is not an option, to log sqlite commands, than using something similar to this LD_PRELOAD shim? https://github.com/smarek/sqlite3-preload I've read https://www.sqlite.org/debugging.html Apart from compile-time debug

Re: [sqlite] Problem with clause "where X in (...)"

2019-02-13 Thread Jose Isaias Cabrera
Click on the link at the bottom of this email... From: sqlite-users on behalf of Don Walsh Sent: Wednesday, February 13, 2019 03:09 PM To: SQLite mailing list Subject: Re: [sqlite] Problem with clause "where X in (...)" Get me of this list On Wed, Feb 13,

Re: [sqlite] Problem with clause "where X in (...)"

2019-02-13 Thread J. King
On February 13, 2019 3:09:31 PM EST, Don Walsh wrote: >Get me of this list > >On Wed, Feb 13, 2019, 8:11 AM David Raymond wrote: > >> Here's the page with the limits for what you can give SQLite >> https://www.sqlite.org/limits.html >> >> Depending on what your statement ended up looking like

Re: [sqlite] Problem with clause "where X in (...)"

2019-02-13 Thread Don Walsh
Get me of this list On Wed, Feb 13, 2019, 8:11 AM David Raymond Here's the page with the limits for what you can give SQLite > https://www.sqlite.org/limits.html > > Depending on what your statement ended up looking like that could be the > "Maximum Length of an SQL Statement" of 1,000,000 or

Re: [sqlite] Am I understanding how to use ROLLBACK - SAVEPOINT correctly?

2019-02-13 Thread Scott
Andy, David, Tim!!! Thanks for the help and advice... I think I will name mine "theKraken"... ;) LOL! Scott ValleryEcclesiastes 4:9-10 On Wednesday, February 13, 2019, 10:34:51 AM EST, Tim Streater wrote: On 13 Feb 2019, at 15:23, David Raymond wrote: > On a humor tangent, am I the

Re: [sqlite] Checking differences in tables

2019-02-13 Thread Don Walsh
Remove me On Wed, Feb 13, 2019, 12:54 PM Jose Isaias Cabrera > James K. Lowden, on Tuesday, February 12, 2019 11:39 AM, wrote... > >On Tue, 12 Feb 2019 15:05:29 + > >Jose Isaias Cabrera wrote: > > > >> >SELECT * From t WHERE datestamp = "20190208" > >> > >> Ok, Simon, I'll bite; :-)

Re: [sqlite] Checking differences in tables

2019-02-13 Thread Jose Isaias Cabrera
James K. Lowden, on Tuesday, February 12, 2019 11:39 AM, wrote... >On Tue, 12 Feb 2019 15:05:29 + >Jose Isaias Cabrera wrote: > >> >SELECT * From t WHERE datestamp = "20190208" >> >> Ok, Simon, I'll bite; :-) Imagine this table: >> >> t (n INTEGER PRIMARY KEY, a, b, c, d, e, idate) > >That's

Re: [sqlite] Am I understanding how to use ROLLBACK - SAVEPOINT correctly?

2019-02-13 Thread Tim Streater
On 13 Feb 2019, at 15:23, David Raymond wrote: > On a humor tangent, am I the only person who has ever named a savepoint > "theHounds" for the sole purpose of being able to run the statement: > > release theHounds; welease Bwian; -- Cheers -- Tim

Re: [sqlite] Am I understanding how to use ROLLBACK - SAVEPOINT correctly?

2019-02-13 Thread David Raymond
When you "rollback to something;" any work since that savepoint was created is un-done, but that named savepoint still exists, yes. That caught me out once where my code was like for each line in the file: savepoint foo do several inserts/updates if they all went ok: release

Re: [sqlite] Am I understanding how to use ROLLBACK - SAVEPOINT correctly?

2019-02-13 Thread Andy Bennett
Hi, For example, would I do this: Connect to the DB [ Pass the command to save: ]SAVEPOINT 'current' [ User choices are processed: SELECT and UPDATE statements ] [ if error or user changes their mind ]    ROLLBACK TRANSACTION TO SAVEPOINT 'current' [ otherwise... upon success ]    RELEASE

Re: [sqlite] Problem with clause "where X in (...)"

2019-02-13 Thread David Raymond
Here's the page with the limits for what you can give SQLite https://www.sqlite.org/limits.html Depending on what your statement ended up looking like that could be the "Maximum Length of an SQL Statement" of 1,000,000 or maybe Maximum Number of Columns of 2,000? Check to see if you're

Re: [sqlite] Problem with clause "where X in (...)"

2019-02-13 Thread Richard Hipp
Your message is incomplete. Do you have a test case that we can see? On 2/13/19, Mohd Radzi Ibrahim wrote: > Hi, > I thought that I hit a bug with SQLite 3.28.0 and 3.27.1 when my in-list > contains too many items the code breaks here: > > The sqlite3_step just exit without returning any error

[sqlite] Problem with clause "where X in (...)"

2019-02-13 Thread Mohd Radzi Ibrahim
Hi, I thought that I hit a bug with SQLite 3.28.0 and 3.27.1 when my in-list contains too many items the code breaks here: The sqlite3_step just exit without returning any error code. best regards, Radzi ___ sqlite-users mailing list

[sqlite] Am I understanding how to use ROLLBACK - SAVEPOINT correctly?

2019-02-13 Thread Scott
Hi All! I've been reading about SAVEPOINT and ROLLBACK in the SQLite documentation. My project has an embedded SQLite DB with multiple tables (relational) that may or may not be read or updated because of choices the user makes.  Am I understanding correctly that I can use these commands to

Re: [sqlite] Tips for index creation

2019-02-13 Thread Thomas Kurz
Ok, thank you very much for everybody's help. - Original Message - From: Shawn Wagner To: SQLite mailing list Sent: Wednesday, February 13, 2019, 13:58:19 Subject: [sqlite] Tips for index creation Some useful reading: https://use-the-index-luke.com/

Re: [sqlite] Checking differences in tables

2019-02-13 Thread Jose Isaias Cabrera
Man, you guys are so smart... Thanks, Keith. From: sqlite-users on behalf of Keith Medcalf Sent: Wednesday, February 13, 2019 02:31 AM To: SQLite mailing list Subject: Re: [sqlite] Checking differences in tables insert into t (a, b, c, d, e, idate) values ('p001', 1, 2, (SELECT d FROM t

Re: [sqlite] Tips for index creation

2019-02-13 Thread Shawn Wagner
Some useful reading: https://use-the-index-luke.com/ https://www.sqlite.org/queryplanner.html (and the pages it links to) There's also the .expert command in the sqlite shell: sqlite> .expert sqlite> SELECT ... FROM ...; will suggest indexes that will benefit a particular query. On Wed, Feb

Re: [sqlite] Tips for index creation

2019-02-13 Thread R Smith
On 2019/02/13 2:39 PM, Thomas Kurz wrote: Hello, I apologize right at the beginning, because this is a real noob question. But I don't have much experience with performance optimization and indexes, so I'm hoping for some useful hints what indexes to create. I have queries like this:

Re: [sqlite] Tips for index creation

2019-02-13 Thread Richard Hipp
On 2/13/19, Thomas Kurz wrote: > Hello, > > I apologize right at the beginning, because this is a real noob question. > But I don't have much experience with performance optimization and indexes, > so I'm hoping for some useful hints what indexes to create. > > I have queries like this: > >

[sqlite] Tips for index creation

2019-02-13 Thread Thomas Kurz
Hello, I apologize right at the beginning, because this is a real noob question. But I don't have much experience with performance optimization and indexes, so I'm hoping for some useful hints what indexes to create. I have queries like this: SELECT parameter, value FROM metadata WHERE id1=a

Re: [sqlite] Building Amalgamation

2019-02-13 Thread D Burgess
Maybe not. See https://www.sqlite.org/compile.html#_options_to_omit_features to quote "Because of this, these options may only be used when the library is built from canonical source, not from the amalgamation " So the lists in the two places of the

Re: [sqlite] Building Amalgamation

2019-02-13 Thread Simon Slavin
On 13 Feb 2019, at 6:09am, D Burgess wrote: > 3.6.20 is a loong time ago. Which led me to think that maybe that list is no > longer be accurate. > Is there an easy way to extract the available options for the latest release? This is not something I normally worry about, but is the list here