Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
With long names turned on the columns are named differently when returned though the aliased subquery. Since a dot (.) is the separator between the schema.table or table.column and the column name contains an embedded dot, you have to quote the name ... This is probably why long_column_names

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
On Thu, Aug 15, 2019 at 4:52 PM Keith Medcalf wrote: > > The query does not work because it is defective. The column name pragma's > only affect the column names that your program sees, not the names used > internally in the SQL statement. It does not affect the identifier use > internally.

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
The query does not work because it is defective. The column name pragma's only affect the column names that your program sees, not the names used internally in the SQL statement. It does not affect the identifier use internally. If your internal identifier use is defective, then it is

Re: [sqlite] Getting a notification when a write lock is released.

2019-08-15 Thread test user
Thanks Simon, > You can use any other combination that suits you. Perhaps set a short > timeout, after which SQLite calls your busy handler, which can do whatever > it wants then return SQLITE_BUSY to your program. When the short timeout > gets exhausted, SQLite calls your own busy handler,

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
Aha! Found and fixed some bugs in my apsw wrapper for stuff that I do not do often (such as using * to retrieve duplicate column names as I typically always use AS to name columns explicitly, so the Row was being built with duplicate names). Also, removed the code that disabled the

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
On Thu, Aug 15, 2019 at 2:53 PM Keith Medcalf wrote: > > Using AS to name columns means NOT using *. One only uses * when one does > not care about column names (or the ordering of the result columns). > Sounds like a personal gospel. This is closer to the test case (yes it doesn't make a

Re: [sqlite] Getting a notification when a write lock is released.

2019-08-15 Thread Simon Slavin
On 15 Aug 2019, at 10:43pm, test user wrote: > Currently the API lets you set a timeout. Does this just retry again after a > set amount of time? SQLite's built-in busy handler (which it uses unless you tell it to use yours instead) repeatedly backs off and retries until the timeout you set

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
Using AS to name columns means NOT using *. One only uses * when one does not care about column names (or the ordering of the result columns). select address.id AS address_id, address.nameAS address_name, user.id AS user_id, user.address_id AS

Re: [sqlite] Getting a notification when a write lock is released.

2019-08-15 Thread test user
> > SQLite could support this in theory. But if the process holding the > lock is hung, that would hang the process waiting on the look too. > > Getting SQLITE_BUSY is annoying, but it is not nearly as annoying as > getting a > hung process. > > I am not aware of a way to do a blocking file

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
> > > > sqlite> select * from ( select count(*)count,* from addresses join users > on users.address_id=addresses.id ) address join pets pet on pet.user_id= > address.users.id; > Error: no such column: address.users.id > > >> console.log( db.do( "select count(*)count,* from ( select count(*)count,*

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
On Thu, Aug 15, 2019 at 12:33 PM J Decker wrote: > > > On Thu, Aug 15, 2019 at 12:24 PM Keith Medcalf > wrote: > >> After fixing the errors in the script (strings are quoted with single >> quotes, not double quotes): >> > .headers on > pragma full_column_names=1; > pragma short_column_names=0;

Re: [sqlite] Getting a notification when a write lock is released.

2019-08-15 Thread Keith Medcalf
On Thursday, 15 August, 2019 13:11, test user wrote: >If two processes are writing to the same db file, one will get a BUSY >response if the other has locked it. >Currently the API lets you set a timeout. Does this just retry again >after a set amount of time? timeout specifies the time

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
On Thu, Aug 15, 2019 at 12:24 PM Keith Medcalf wrote: > After fixing the errors in the script (strings are quoted with single > quotes, not double quotes): > sqlite> .headers on > sqlite> create table addresses( id, name ); > sqlite> create table users( id, address_id, name ); > sqlite> create

Re: [sqlite] Getting a notification when a write lock is released.

2019-08-15 Thread Richard Hipp
On 8/15/19, test user wrote: > Hello, > > If two processes are writing to the same db file, one will get a BUSY > response if the other has locked it. > > Currently the API lets you set a timeout. Does this just retry again after > a set amount of time? Yes. It retries multiple times,

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
After fixing the errors in the script (strings are quoted with single quotes, not double quotes): sqlite> .headers on sqlite> create table addresses( id, name ); sqlite> create table users( id, address_id, name ); sqlite> create table pets(id, user_id, name ); sqlite> sqlite> insert into

Re: [sqlite] Programming methodology (was DEF CON (wasL A license plate of NULL))

2019-08-15 Thread Tim Streater
On 15 Aug 2019, at 18:13, James K. Lowden wrote: > On Tue, 13 Aug 2019 16:47:43 -0400 > Richard Hipp wrote: > >> On 8/13/19, Jose Isaias Cabrera wrote: >> > >> > I see all of you smart programmers using this >> > non-column matching behavior, and I ask myself why? >> >> Because that's the way

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
I was trying a more complex query where the table name isn't a simple table name... select * from ( select * from addresses join user on user.address_id= addresses.id ) address; but that gives like really strange column names... # sqlite3 output id|name|id:1|address_id|name:1 1|there|1|1|bob #

[sqlite] Getting a notification when a write lock is released.

2019-08-15 Thread test user
Hello, If two processes are writing to the same db file, one will get a BUSY response if the other has locked it. Currently the API lets you set a timeout. Does this just retry again after a set amount of time? Or is it possible to get notified immediately when the lock has been released? Can I

Re: [sqlite] Documentation update request

2019-08-15 Thread Jose Isaias Cabrera
Kevin Benson, on Thursday, August 15, 2019 02:40 PM, wrote... > > On Thu, Aug 15, 2019 at 2:33 PM Jose Isaias Cabrera, on > wrote: > > Oh! Trickery! > > > > > Dickery (sometimes a nickname for RICHARD ;-) > Doc (...umentation; the something Richard "Dick" Hipp was doing ;-) I could never use

[sqlite] Request to get alias of table

2019-08-15 Thread J Decker
I would really like to get the table alias specified in the query, with an unpatched version of Sqlite. So here's a script... -- .headers on create table addresses( id, name ); create table users( id, address_id, name ); create table pets(id, user_id, name ); insert into

Re: [sqlite] Documentation update request

2019-08-15 Thread Kevin Benson
On Thu, Aug 15, 2019 at 2:33 PM Jose Isaias Cabrera wrote: > Richard Hipp, on Thursday, August 15, 2019 01:32 PM, wrote... > > > > On 8/15/19, Simon Slavin, on > > > On 15 Aug 2019, at 5:20pm, Richard Damon, on > > > > > >> You under quote, the faq says it “can not be changed (except under > >

Re: [sqlite] Documentation update request

2019-08-15 Thread Jose Isaias Cabrera
Richard Hipp, on Thursday, August 15, 2019 01:32 PM, wrote... > > On 8/15/19, Simon Slavin, on > > On 15 Aug 2019, at 5:20pm, Richard Damon, on > > > >> You under quote, the faq says it “can not be changed (except under > >> extra-ordinary conditions).”, and those extra-ordinary conditions are a >

Re: [sqlite] Will rootpage number ever change?

2019-08-15 Thread Keith Medcalf
On Thursday, 15 August, 2019 08:02, Jose Isaias Cabrera wrote: >Thanks for this. What I am looking for is an unique ID that I can >use to call that table. Does that exists in the internal of SQLite? >I know I can create a table myself keep track of them myself, but I >am trying to see if it

Re: [sqlite] Documentation update request

2019-08-15 Thread Richard Hipp
On 8/15/19, Simon Slavin wrote: > On 15 Aug 2019, at 5:20pm, Richard Damon wrote: > >> You under quote, the faq says it “can not be changed (except under >> extra-ordinary conditions).”, and those extra-ordinary conditions are a >> link to the second section you mention. > > I didn't notice

Re: [sqlite] Programming methodology (was DEF CON (wasL A license plate of NULL))

2019-08-15 Thread James K. Lowden
On Tue, 13 Aug 2019 16:47:43 -0400 Richard Hipp wrote: > On 8/13/19, Jose Isaias Cabrera wrote: > > > > I see all of you smart programmers using this > > non-column matching behavior, and I ask myself why? > > Because that's the way Dennis Richie did it. :-) That's right. Like many of a

Re: [sqlite] Documentation update request

2019-08-15 Thread Simon Slavin
On 15 Aug 2019, at 5:20pm, Richard Damon wrote: > You under quote, the faq says it “can not be changed (except under > extra-ordinary conditions).”, and those extra-ordinary conditions are a link > to the second section you mention. I didn't notice that, for some reason. Thanks for the

Re: [sqlite] Documentation update request

2019-08-15 Thread Richard Damon
> On Aug 15, 2019, at 10:37 AM, Simon Slavin wrote: > > > > says that sqlite_master cannot be changed. > > > > tells you how to change it. > You under quote, the faq says it “can not be changed (except

Re: [sqlite] Will rootpage number ever change?

2019-08-15 Thread Simon Slavin
On 15 Aug 2019, at 3:01pm, Jose Isaias Cabrera wrote: > sqlite> SELECT * FROM sqlite_master WHERE type='table' AND name='PMOTitles'; > type|name|tbl_name|rootpage|sql > table|PMOTitles|PMOTitles|11|CREATE TABLE PMOTitles >( > TitleKey PRIMARY KEY, > Titles >) > > What is the

[sqlite] Documentation update request

2019-08-15 Thread Simon Slavin
says that sqlite_master cannot be changed. tells you how to change it. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] Will rootpage number ever change?

2019-08-15 Thread Jose Isaias Cabrera
Richard Hipp, on Thursday, August 15, 2019 09:45 AM, wrote... > > On 8/15/19, Jose Isaias Cabrera, on > > I have no idea > > what that means, but the question I have is, will that number ever change? > > Thanks. > > Yes. Root page numbers will change, for example when you run VACUUM. Yep, you're

Re: [sqlite] Will rootpage number ever change?

2019-08-15 Thread Richard Hipp
On 8/15/19, Jose Isaias Cabrera wrote: > I have no idea > what that means, but the question I have is, will that number ever change? > Thanks. Yes. Root page numbers will change, for example when you run VACUUM. An SQLite database consists of a "forest" of b-trees. Each table and each index is

Re: [sqlite] divide-by-zero bug in whereLoopAddBtreeIndex function

2019-08-15 Thread Xingwei Lin
Hi, Richard: Sorry for that, the poc is attached here. On Thu, Aug 15, 2019 at 9:08 PM Richard Hipp wrote: > The mailing list strips attachments as an anti-spam measure. Please > send the POC directly d...@sqlite.org. > > On 8/15/19, Xingwei Lin wrote: > > Attach is the poc sql file. > > I

[sqlite] Will rootpage number ever change?

2019-08-15 Thread Jose Isaias Cabrera
Greetings. When I run this command, sqlite> SELECT * FROM sqlite_master WHERE type='table' AND name='PMOTitles'; type|name|tbl_name|rootpage|sql table|PMOTitles|PMOTitles|560|CREATE TABLE PMOTitles ( TitleKey PRIMARY KEY, Titles ) sqlite> I see that there is a rootpage

Re: [sqlite] divide-by-zero bug in whereLoopAddBtreeIndex function

2019-08-15 Thread Richard Hipp
The mailing list strips attachments as an anti-spam measure. Please send the POC directly d...@sqlite.org. On 8/15/19, Xingwei Lin wrote: > Attach is the poc sql file. > I used the following command: -- D. Richard Hipp d...@sqlite.org ___

[sqlite] divide-by-zero bug in whereLoopAddBtreeIndex function

2019-08-15 Thread Xingwei Lin
Hi, all I found a divide-by-zero bug in *whereLoopAddBtreeIndex* function in version 3.29.0. The GDB debug traces are: > #0 0x561757f1e842 in whereLoopAddBtreeIndex (pBuilder=0x7ffea0f422a0, > pSrc=0x56175954b070, pProbe=0x561759565e78, nInMul=0) at sqlite3.c:143263 > #1