Autocomplete functions in the Fuzzycomplete DuckDB extension
Function category
Autocomplete
1 functionInspect what the fuzzy completer would suggest for a given partial query. Once the extension is loaded the DuckDB CLI uses this internally for Tab-completion — the function exists mainly for testing and for scripts that want to surface suggestions programmatically.
Signature
Arguments
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
sql
|
Type
VARCHAR
|
Mode Positional | Description The partial SQL text the user has typed. Suggestions are ranked by fuzzy match score against keywords and identifiers (databases, schemas, tables, columns) currently visible to the session. Positional only. |
Argument
max_suggestion_count
|
Type
UBIGINT
|
Mode Named | Description Maximum number of suggestions to return (default 20). Values larger than the number of candidates are fine. Accepted for compatibility with the stock autocomplete extension. |
Argument
max_file_suggestion_count
|
Type
UBIGINT
|
Mode Named | Description Maximum number of file and directory suggestions to return (default 20). Accepted for compatibility with the stock autocomplete extension. |
Argument
max_exact_suggestion_count
|
Type
UBIGINT
|
Mode Named | Description Accepted for compatibility with the stock autocomplete extension; has no effect, since fuzzy matching has no exact-only tail. |
Description
Return ranked autocomplete suggestions for a partial SQL string using the VS-Code-derived fuzzy matcher. Used by the DuckDB CLI for Tab-completion; you can also call it directly in SQL. Returns the same five columns as the stock extension: suggestion, suggestion_start, suggestion_type, suggestion_score (0 for the best match, lower is better) and extra_char. With the v1.5 activation fix, loading fuzzycomplete replaces the preloaded stock provider. Older build 9746833 leaves the stock provider active when autocomplete is already loaded. On DuckDB 2.0 (build 2026110701 and later), equally good fuzzy matches are ordered by relevance (common statement keywords first, your own tables before built-in ones, columns of the tables named in the query first), block comments are skipped, file names that are not valid UTF-8 are ignored instead of aborting the shell, and file and directory completion fails with a permission error when enable_external_access is false.
SELECT trim(suggestion) AS suggestion
FROM sql_auto_complete('SEL')
LIMIT 3;
SELECT suggestion
FROM sql_auto_complete('SELECT * FROM tables')
LIMIT 1;
SELECT suggestion
FROM sql_auto_complete('SELECT * FROM gnst');
CREATE TABLE store_inventory (order_quantity INTEGER);
CREATE TABLE customer_order_history (order_id INTEGER);
SELECT suggestion, suggestion_type
FROM sql_auto_complete('SELECT * FROM store_inventory WHERE ordr')
LIMIT 1;