SQLite User Forum

CLI: .selftest missing in .help
Login

CLI: .selftest missing in .help

(1) By anonymous on 2024-04-04 05:51:15 [link] [source]

.selftest is described on https://sqlite.org/cli.html but not shown on the dot-command listing there neither with .help currently on 3.45.2

(2) By Stephan Beal (stephan) on 2024-04-04 08:02:52 in reply to 1 [link] [source]

.selftest ... not shown on the dot-command listing there neither with .help currently on

That command, along with a handful of others, is very specifically filtered out of the default help view. Use .help -all to see the help for all commands, including "internal" ones like .selftest.

(3) By anonymous on 2024-04-04 08:46:31 in reply to 2 [link] [source]

thanks, but even .help -all does not list it...

(4) By Stephan Beal (stephan) on 2024-04-04 08:53:49 in reply to 3 [link] [source]

even .help -all does not list it...

$ ./sqlite3 
SQLite version 3.46.0 2024-04-02 21:55:45
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .help -all
...
.selftest ?OPTIONS?      Run tests defined in the SELFTEST table
    Options:
       --init               Create a new SELFTEST table
       -v                   Verbose output
...

(5) By anonymous on 2024-04-04 09:05:09 in reply to 4 [link] [source]

I am very sorry:

C:\Users\Asus2022A\Desktop\sqlite-tools-win-x64-3450200>sqlite3
SQLite version 3.45.2 2024-03-12 11:06:23 (UTF-16 console I/O)
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .help -all
.archive ...             Manage SQL archives
   Each command must have exactly one of the following options:
     -c, --create               Create a new archive
     -u, --update               Add or update files with changed mtime
     -i, --insert               Like -u but always add even if unchanged
     -r, --remove               Remove files from archive
     -t, --list                 List contents of archive
     -x, --extract              Extract files from archive
   Optional arguments:
     -v, --verbose              Print each filename as it is processed
     -f FILE, --file FILE       Use archive FILE (default is current db)
     -a FILE, --append FILE     Open FILE using the apndvfs VFS
     -C DIR, --directory DIR    Read/extract files from directory DIR
     -g, --glob                 Use glob matching for names in archive
     -n, --dryrun               Show the SQL that would have occurred
   Examples:
     .ar -cf ARCHIVE foo bar  # Create ARCHIVE from files foo and bar
     .ar -tf ARCHIVE          # List members of ARCHIVE
     .ar -xvf ARCHIVE         # Verbosely extract files from ARCHIVE
   See also:
      http://sqlite.org/cli.html#sqlite_archive_support
.auth ON|OFF             Show authorizer callbacks
.backup ?DB? FILE        Backup DB (default "main") to FILE
   Options:
       --append            Use the appendvfs
       --async             Write to FILE without journal and fsync()
.bail on|off             Stop after hitting an error.  Default OFF
.cd DIRECTORY            Change the working directory to DIRECTORY
.changes on|off          Show number of rows changed by SQL
.check GLOB              Fail if output since .testcase does not match
.clone NEWDB             Clone data into NEWDB from the existing database
.connection [close] [#]  Open or close an auxiliary database connection
.crnl on|off             Translate \n to \r\n.  Default ON
.databases               List names and files of attached databases
.dbconfig ?op? ?val?     List or change sqlite3_db_config() options
.dbinfo ?DB?             Show status information about the database
.dump ?OBJECTS?          Render database content as SQL
   Options:
     --data-only            Output only INSERT statements
     --newlines             Allow unescaped newline characters in output
     --nosys                Omit system tables (ex: "sqlite_stat1")
     --preserve-rowids      Include ROWID values in the output
   OBJECTS is a LIKE pattern for tables, indexes, triggers or views to dump
   Additional LIKE patterns can be given in subsequent arguments
.echo on|off             Turn command echo on or off
.eqp on|off|full|...     Enable or disable automatic EXPLAIN QUERY PLAN
   Other Modes:
      trigger               Like "full" but also show trigger bytecode
.excel                   Display the output of next command in spreadsheet
   --bom                   Put a UTF8 byte-order mark on intermediate file
.exit ?CODE?             Exit this program with return-code CODE
.expert                  EXPERIMENTAL. Suggest indexes for queries
.explain ?on|off|auto?   Change the EXPLAIN formatting mode.  Default: auto
.filectrl CMD ...        Run various sqlite3_file_control() operations
   --schema SCHEMA         Use SCHEMA instead of "main"
   --help                  Show CMD details
.fullschema ?--indent?   Show schema and the content of sqlite_stat tables
.headers on|off          Turn display of headers on or off
.help ?-all? ?PATTERN?   Show help text for PATTERN
.import FILE TABLE       Import data from FILE into TABLE
   Options:
     --ascii               Use \037 and \036 as column and row separators
     --csv                 Use , and \n as column and row separators
     --skip N              Skip the first N rows of input
     --schema S            Target table to be S.TABLE
     -v                    "Verbose" - increase auxiliary output
   Notes:
     *  If TABLE does not exist, it is created.  The first row of input
        determines the column names.
     *  If neither --csv or --ascii are used, the input mode is derived
        from the ".mode" output mode
     *  If FILE begins with "|" then it is a command that generates the
        input text.
.indexes ?TABLE?         Show names of indexes
                           If TABLE is specified, only show indexes for
                           tables matching TABLE using the LIKE operator.
.limit ?LIMIT? ?VAL?     Display or change the value of an SQLITE_LIMIT
.lint OPTIONS            Report potential schema issues.
     Options:
        fkey-indexes     Find missing foreign key indexes
.load FILE ?ENTRY?       Load an extension library
.log FILE|on|off         Turn logging on or off.  FILE can be stderr/stdout
.mode MODE ?OPTIONS?     Set output mode
   MODE is one of:
     ascii       Columns/rows delimited by 0x1F and 0x1E
     box         Tables using unicode box-drawing characters
     csv         Comma-separated values
     column      Output in columns.  (See .width)
     html        HTML <table> code
     insert      SQL insert statements for TABLE
     json        Results in a JSON array
     line        One value per line
     list        Values delimited by "|"
     markdown    Markdown table format
     qbox        Shorthand for "box --wrap 60 --quote"
     quote       Escape answers as for SQL
     table       ASCII-art table
     tabs        Tab-separated values
     tcl         TCL list elements
   OPTIONS: (for columnar modes or insert mode):
     --wrap N       Wrap output lines to no longer than N characters
     --wordwrap B   Wrap or not at word boundaries per B (on/off)
     --ww           Shorthand for "--wordwrap 1"
     --quote        Quote output text as SQL literals
     --noquote      Do not quote output text
     TABLE          The name of SQL table used for "insert" mode
.nonce STRING            Suspend safe mode for one command if nonce matches
.nullvalue STRING        Use STRING in place of NULL values
.once ?OPTIONS? ?FILE?   Output for the next SQL command only to FILE
     If FILE begins with '|' then open as a pipe
       --bom  Put a UTF8 byte-order mark at the beginning
       -e     Send output to the system text editor
       -x     Send output as CSV to a spreadsheet (same as ".excel")
.open ?OPTIONS? ?FILE?   Close existing database and reopen FILE
     Options:
        --append        Use appendvfs to append database to the end of FILE
        --deserialize   Load into memory using sqlite3_deserialize()
        --hexdb         Load the output of "dbtotxt" as an in-memory db
        --maxsize N     Maximum size for --hexdb or --deserialized database
        --new           Initialize FILE to an empty database
        --nofollow      Do not follow symbolic links
        --readonly      Open FILE readonly
        --zip           FILE is a ZIP archive
.output ?FILE?           Send output to FILE or stdout if FILE is omitted
   If FILE begins with '|' then open it as a pipe.
   Options:
     --bom                 Prefix output with a UTF8 byte-order mark
     -e                    Send output to the system text editor
     -x                    Send output as CSV to a spreadsheet
.parameter CMD ...       Manage SQL parameter bindings
   clear                   Erase all bindings
   init                    Initialize the TEMP table that holds bindings
   list                    List the current parameter bindings
   set PARAMETER VALUE     Given SQL parameter PARAMETER a value of VALUE
                           PARAMETER should start with one of: $ : @ ?
   unset PARAMETER         Remove PARAMETER from the binding table
.print STRING...         Print literal STRING
.progress N              Invoke progress handler after every N opcodes
   --limit N                 Interrupt after N progress callbacks
   --once                    Do no more than one progress interrupt
   --quiet|-q                No output except at interrupts
   --reset                   Reset the count for each input and interrupt
.prompt MAIN CONTINUE    Replace the standard prompts
.quit                    Stop interpreting input stream, exit if primary.
.read FILE               Read input from FILE or command output
    If FILE begins with "|", it is a command that generates the input.
.recover                 Recover as much data as possible from corrupt db.
   --ignore-freelist        Ignore pages that appear to be on db freelist
   --lost-and-found TABLE   Alternative name for the lost-and-found table
   --no-rowids              Do not attempt to recover rowid values
                            that are not also INTEGER PRIMARY KEYs
.restore ?DB? FILE       Restore content of DB (default "main") from FILE
.save ?OPTIONS? FILE     Write database to FILE (an alias for .backup ...)
.scanstats on|off|est    Turn sqlite3_stmt_scanstatus() metrics on or off
.schema ?PATTERN?        Show the CREATE statements matching PATTERN
   Options:
      --indent             Try to pretty-print the schema
      --nosys              Omit objects whose names start with "sqlite_"
.separator COL ?ROW?     Change the column and row separators
.session ?NAME? CMD ...  Create or control sessions
   Subcommands:
     attach TABLE             Attach TABLE
     changeset FILE           Write a changeset into FILE
     close                    Close one session
     enable ?BOOLEAN?         Set or query the enable bit
     filter GLOB...           Reject tables matching GLOBs
     indirect ?BOOLEAN?       Mark or query the indirect status
     isempty                  Query whether the session is empty
     list                     List currently open session names
     open DB NAME             Open a new session on DB
     patchset FILE            Write a patchset into FILE
   If ?NAME? is omitted, the first defined session is used.
.sha3sum ...             Compute a SHA3 hash of database content
    Options:
      --schema              Also hash the sqlite_schema table
      --sha3-224            Use the sha3-224 algorithm
      --sha3-256            Use the sha3-256 algorithm (default)
      --sha3-384            Use the sha3-384 algorithm
      --sha3-512            Use the sha3-512 algorithm
    Any other argument is a LIKE pattern for tables to hash
.shell CMD ARGS...       Run CMD ARGS... in a system shell
.show                    Show the current values for various settings
.stats ?ARG?             Show stats or turn stats on or off
   off                      Turn off automatic stat display
   on                       Turn on automatic stat display
   stmt                     Show statement stats
   vmstep                   Show the virtual machine step count only
.system CMD ARGS...      Run CMD ARGS... in a system shell
.tables ?TABLE?          List names of tables matching LIKE pattern TABLE
.timeout MS              Try opening locked tables for MS milliseconds
.timer on|off            Turn SQL timer on or off
.trace ?OPTIONS?         Output each SQL statement as it is run
    FILE                    Send output to FILE
    stdout                  Send output to stdout
    stderr                  Send output to stderr
    off                     Disable tracing
    --expanded              Expand query parameters
    --plain                 Show SQL as it is input
    --stmt                  Trace statement execution (SQLITE_TRACE_STMT)
    --profile               Profile statements (SQLITE_TRACE_PROFILE)
    --row                   Trace each row (SQLITE_TRACE_ROW)
    --close                 Trace connection close (SQLITE_TRACE_CLOSE)
.version                 Show source, library and compiler versions
.vfsinfo ?AUX?           Information about the top-level VFS
.vfslist                 List all available VFSes
.vfsname ?AUX?           Print the name of the VFS stack
.width NUM1 NUM2 ...     Set minimum column widths for columnar output
     Negative values right-justify

(6) By Stephan Beal (stephan) on 2024-04-04 09:19:38 in reply to 5 [link] [source]

I am very sorry:

It's in the latest trunk and that part of the code was last changed almost a year ago: src:17f5dd2d2ae02a95

(UTF-16 console I/O)

Notice that "testctl" is also not listed, which suggests that UTF-16 mode is somehow interfering with argument processing.

(8) By Stephan Beal (stephan) on 2024-04-04 16:00:13 in reply to 6 [link] [source]

(UTF-16 console I/O)

@OP are you running on Windows 7 and did you copy/paste the .help -all command or type it in? We have seen strange things happen when pasting into the sqlite3 shell in a Win7 console, but otherwise cannot explain why the "-all" flag is not working for you.

In any case, as Larry says: the internal commands are not listed by default for the simple reason that they're not stable and not intended for client-side use. They're for use in testing sqlite3 itself. .selfcheck is documented on the website primarily so that the developers have a reference for it.

(9) By anonymous on 2024-04-08 05:18:43 in reply to 8 [link] [source]

Win 11 Pro, typed in directly.

(7) By Larry Brasfield (larrybr) on 2024-04-04 15:15:34 in reply to 3 [source]

To see all the dot commands, including the undocumented ones, enter:
.help 0

The undocumented commands should not be considered stable. Relying upon them in scripts is not recommended.

(10) By anonymous on 2024-04-08 05:21:57 in reply to 7 [link] [source]

ok, thx, that should be documented somewhere.

just to be correct, it does not show all commands, only the ones not visible with .help -all:

sqlite> .help 0
.imposter INDEX TABLE    Create imposter table TABLE on index INDEX
.selftest ?OPTIONS?      Run tests defined in the SELFTEST table
    Options:
       --init               Create a new SELFTEST table
       -v                   Verbose output
.testcase NAME           Begin redirecting output to 'testcase-out.txt'
.testctrl CMD ...        Run various sqlite3_test_control() operations
                           Run ".testctrl" with no arguments for details
sqlite>