Re: [sqlite] sqlite_column_table_name() and table alias name

2018-01-15 Thread Jake Chen
inal patch working <https://github.com/dotnil/node-sqlite3/blob/master/deps/sqlite3.patch> in my fork of node-sqlite3. > On 16 Jan 2018, at 10:11 AM, J Decker wrote: > > On Mon, Jan 15, 2018 at 5:34 PM, Jake Chen wrote: > >> The example result is a demonstration of

Re: [sqlite] sqlite_column_table_name() and table alias name

2018-01-15 Thread Jake Chen
Hi Clemens, You're right. I didn't look into your SQL carefully enough. As a reference, in MySQL the table of id would be the first table it belongs to. `articles` it is. Jake > On 15 Jan 2018, at 11:03 PM, Clemens Ladisch wrote: > > Jake Chen wrote: >>> On 15 J

Re: [sqlite] sqlite_column_table_name() and table alias name

2018-01-15 Thread Jake Chen
The example result is a demonstration of results nested with table alias right? If that's the case I think the `select 1, 1` part should result in: [ { '': { '1': 1 } } ] There's no need to return both. If the results should not be nested, here the result I'd expect: [ { '1': 1 } ] With corr

Re: [sqlite] sqlite_column_table_name() and table alias name

2018-01-15 Thread Jake Chen
`articles.gmt_delete+tags.type` is an select expression, both the original column name and table name should be empty. 42 is a literal, both the original column name and table name should be empty too. `id` is ambiguous here. Proper SQL might require it be prefixed with qualifier (either `articl

Re: [sqlite] sqlite_column_table_name() and table alias name (J Decker)

2018-01-15 Thread Jake Chen
Hi J Decker, I've got the amalgamation patch working now. However it seems the alias of subquery isn't processed correctly. The full SQL: SELECT "posts".*, "tagMaps".*, "topics".* FROM (SELECT * FROM "articles" WHERE "gmt_deleted" IS NULL) AS "posts" LEFT JOIN "tag_maps" AS "tagMaps" ON "

Re: [sqlite] sqlite_column_table_name() and table alias name

2018-01-15 Thread Jake Chen
Hi Decker, The last one is the one expected. If queried with `nestTables` positive, the result should be something like: [ { foo: { id: 1, parent_id: 3 }, bar: { id: 3, parent_id: null } }, { foo: { id: 2, parent_id: 4 }, bar: { id: 4, parent_id: null } } ] Regarding your patch, is th

Re: [sqlite] sqlite_column_table_name() and table alias name

2018-01-14 Thread Jake Chen
Hi Peter, Currently the query result returned by node-sqlite3 has the rows formatted into objects all ready. Given SQL `SELECT foo.*, bar.* FROM foo JOIN bar`, the columns of foo and bar collide with each other. I've already sent a PR https://github.com/mapbox/node-sqlite3/pull/932

Re: [sqlite] sqlite_column_table_name() and table alias name

2018-01-14 Thread Jake Chen
ated to the original post, here's the link http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/2014-November/056379.html <http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/2014-November/056379.html> Jake Chen __