SQLite User Forum

Generated Columns: no autocomplete
Login

Generated Columns: no autocomplete

(1) By Roman (moskvich412) on 2024-07-04 02:18:56 [source]

Dear SQLite developers,

This is not a big issue and maybe it was fixed already in later versions. I use 3.44.2. 

I noticed that autocomplete does not work in sqlite3 shell on generated columns:

CREATE TABLE t1(
aaa INT, 
bbb INT GENERATED ALWAYS AS (abs(aaa)) VIRTUAL, 
ccc INT GENERATED ALWAYS AS (abs(aaa)) STORED);

when I type

SELECT aa

and press tab key, full column name, aaa, appears. Pressing tab does nothing on "bb" nor "cc".

Thank you,

Roman

(2) By SeverKetor on 2024-07-04 02:39:12 in reply to 1 [link] [source]

It still happens. Just built from trunk and get the same thing.

(3) By Bo Lindbergh (_blgl_) on 2024-07-04 06:39:05 in reply to 1 [link] [source]

Trivially fixable.

Index: ext/misc/completion.c
==================================================================
--- ext/misc/completion.c
+++ ext/misc/completion.c
@@ -249,11 +249,11 @@
           while( sqlite3_step(pS2)==SQLITE_ROW ){
             const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
             zSql = sqlite3_mprintf(
                "%z%s"
                "SELECT pti.name FROM \"%w\".sqlite_schema AS sm"
-                       " JOIN pragma_table_info(sm.name,%Q) AS pti"
+                       " JOIN pragma_table_xinfo(sm.name,%Q) AS pti"
                " WHERE sm.type='table'",
                zSql, zSep, zDb, zDb
             );
             if( zSql==0 ) return SQLITE_NOMEM;
             zSep = " UNION ";

(4) By Stephan Beal (stephan) on 2024-07-04 09:45:58 in reply to 3 [link] [source]

Index: ext/misc/completion.c

Nice catch, Bo :). That's now fixed.

(5) By Roman (moskvich412) on 2024-07-14 03:23:21 in reply to 4 [link] [source]

Thank you !