Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 724578 - dev-db/sqlite-3.31.1: syntax error for DELETE with LIMIT, although compiled with ENABLE_UPDATE_DELETE_LIMIT flag
Summary: dev-db/sqlite-3.31.1: syntax error for DELETE with LIMIT, although compiled w...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal enhancement (vote)
Assignee: Arfrever Frehtes Taifersar Arahesis
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-22 16:55 UTC by xHire
Modified: 2021-03-29 17:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xHire 2020-05-22 16:55:05 UTC
According to https://www.sqlite.org/lang_delete.html, it should be possible to run a query like `delete from mytable order by id limit 1;`, because sqlite is compiled with ENABLE_UPDATE_DELETE_LIMIT flag (which I can verify with a query `PRAGMA compile_options;`), but it results in `Error: near "ORDER": syntax error` instead.

Reproducible: Always

Steps to Reproduce:
1. Run `sqlite3 :memory:`
2. Execute `create table mytable (id);`
3. Execute `delete from mytable order by id limit 1;`
Actual Results:  
Error: near "ORDER": syntax error

Expected Results:  
no error

Confirmed to work on Debian. Independently confirmed to not work on 3 Gentoo Linux systems.

Might it be that the flag doesn’t reach the Lemon parser generator as is written at https://www.sqlite.org/compile.html#enable_update_delete_limit ?
Comment 1 Arfrever Frehtes Taifersar Arahesis 2020-05-22 17:59:54 UTC
That code works for me.
Maybe try building dev-db/sqlite with USE="tcl" or USE="test" or USE="tools".
Comment 2 xHire 2020-05-22 18:40:14 UTC
You’re right, building with USE="tools" made it work.

I don’t know how big are the benefits of using a different source package when none of those 3 USE flags is used, but if this is to stay, I’d propose not adding ENABLE_UPDATE_DELETE_LIMIT to CPPFLAGS in this case. Then it can be properly detected by applications that the feature is missing.
Comment 3 Ionen Wolkens gentoo-dev 2020-05-22 18:53:59 UTC
Yeah it's because gentoo is using the amalgamation source by default, which doesn't even have lemon so as you suspected...

Seems it's to make tcl optional, if you build with USE=tcl that statement will work (uses the full source instead). Didn't check if more flags are affected...

Debian also builds it that way then provides a separate package for tcl bindings to avoid a runtime dependency (still needed at build time for other reasons).

I'd leave this open, it is a bit of a worry that some syntax won't work with no indication from neither the ebuild nor USE description.
Comment 4 Arfrever Frehtes Taifersar Arahesis 2020-05-22 19:12:45 UTC
Maybe some solution is to add new USE flag, e.g. USE="featureful" or USE="minimal" with inverted meaning and enabled by default.
However USE="minimal" would not really mean minimalness and only slightly smaller set of features than all features enabled with USE="-minimal"...
Comment 5 Arfrever Frehtes Taifersar Arahesis 2020-05-25 10:54:57 UTC
After more thinking, I prefer to enable all features in libsqlite3.so and sqlite3 at least by default, which would mean using Tcl at build time by default.
So something like IUSE="+featureful" or IUSE="minimal".
Comment 6 Arfrever Frehtes Taifersar Arahesis 2020-07-02 13:12:14 UTC
Several extensions are not available in tarball used for non-Tcl build.
Backporting of upstream fixes to tarball used for non-Tcl build requires unnecessary manual work.
Therefore support for non-Tcl build will be dropped.
Comment 7 Larry the Git Cow gentoo-dev 2020-07-04 13:53:00 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f797e0fd4092a1d9e83c23005806a2db3d7bd0c2

commit f797e0fd4092a1d9e83c23005806a2db3d7bd0c2
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2020-07-02 13:54:37 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-07-04 13:52:28 +0000

    dev-db/sqlite: Drop support for non-Tcl build.
    
    Closes: https://bugs.gentoo.org/724578
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-db/sqlite/Manifest             |  1 -
 dev-db/sqlite/sqlite-3.32.3.ebuild | 94 ++++++++------------------------------
 2 files changed, 20 insertions(+), 75 deletions(-)
Comment 8 Larry the Git Cow gentoo-dev 2021-03-29 17:42:54 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2b164ba52c04ff6fb7b8879d35f0f08ee01aed9

commit b2b164ba52c04ff6fb7b8879d35f0f08ee01aed9
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2021-03-29 01:00:00 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2021-03-29 17:42:35 +0000

    dev-db/sqlite: Fix Tcl dependency and detection.
    
    Fixes: f797e0fd4092a1d9e83c23005806a2db3d7bd0c2
    Bug: https://bugs.gentoo.org/724578
    Closes: https://bugs.gentoo.org/773967
    Closes: https://github.com/gentoo/gentoo/pull/19972
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-db/sqlite/sqlite-3.33.0.ebuild | 11 +++++++++--
 dev-db/sqlite/sqlite-3.34.0.ebuild | 11 +++++++++--
 dev-db/sqlite/sqlite-3.34.1.ebuild | 11 +++++++++--
 dev-db/sqlite/sqlite-3.35.0.ebuild | 11 +++++++++--
 dev-db/sqlite/sqlite-3.35.1.ebuild | 11 +++++++++--
 dev-db/sqlite/sqlite-3.35.2.ebuild | 11 +++++++++--
 dev-db/sqlite/sqlite-3.35.3.ebuild | 11 +++++++++--
 7 files changed, 63 insertions(+), 14 deletions(-)