If a package maintainer has included completions then the default TAB completion may have been overridden. This is the case for sqlite3 whose definitions are in: /usr/share/bash-completion/completions/sqlite3
There we see that _filedir "$dbexts" is called.
_filedir is defined in: /usr/share/bash-completions/bash_completion
Viewing its definition (on 24.04) I see that it checks if COMP_FILEDIR_FALLBACK is set. A websearch for that leads me to:
https://github.com/scop/bash-completion/blob/main/doc/configuration.md#bash_completion_filedir_fallback
BASH_COMPLETION_FILEDIR_FALLBACK
If set and not null, completions that look for filenames based on their
"extensions" will fall back to suggesting all files if there are none
matching the sought ones.
Available since version 2.12.
Deprecated alias: COMP_FILEDIR_FALLBACK
Setting the relevant variable should make completions work closer to the way you want. (If some files match the prefix, it will still fail to find the others that don't).
Alternatively, another method mentioned in the documentation is to use a different key instead of TAB, which bypasses the filtering:
https://github.com/scop/bash-completion/blob/main/README.md#faq
Q. The bash completion code inhibits some commands from completing on
files with extensions that are legitimate in my environment. Do I
have to disable completion for that command in order to complete on
the files that I need to?
A. No. If needed just once in a while,
use M-/ to (in the words of the bash man page) attempt file
name completion on the text to the left of the cursor. This will
circumvent any file type restrictions put in place by the bash
completion code. If needed more regularly, see the next question:
sqlite(3)that's a tall order, because you're allowed to name the database file anything you like.bash), typically via thebash-completionpackage. It might be configured in a way to call the said app, or other helpers (as any shell script could), e.g. if you're typing something likefoolite3 --foo [TAB]then it might call a helper program such asfoolite3 --list-available-foosto construct the offerings. The terminal does not take part in this story.complete -p lsandcomplete -p sqlite.