Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in php artisan db:show #44860

Closed
sajaddp opened this issue Nov 7, 2022 · 4 comments · Fixed by #44867
Closed

Error in php artisan db:show #44860

sajaddp opened this issue Nov 7, 2022 · 4 comments · Fixed by #44867
Assignees

Comments

@sajaddp
Copy link

sajaddp commented Nov 7, 2022

  • Laravel Version: 9.38.0
  • PHP Version: 8.1.12
  • Composer Version: 2.4.4
  • Database Driver & Version: sqlite 3.39.4
  • OS: macOS 13.0 (22A380)

Description:

The following error occurs when executing the php artisan db:show command:

 Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1 no such table: dbstat (SQL: SELECT SUM(pgsize) AS size FROM dbstat WHERE name=vsh_action_events)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
    756▕         // If an exception occurs when attempting to run a query, we'll format the error
    757▕         // message to include the bindings with SQL, which will make this exception a
    758▕         // lot more helpful to the developer instead of just the database's errors.
    759▕         catch (Exception $e) {
  ➜ 760▕             throw new QueryException(
    761▕                 $query, $this->prepareBindings($bindings), $e
    762▕             );
    763▕         }
    764▕     }

Steps To Reproduce:

Update Laravel to the latest version.
Run this command:

php artisan db:show
@jbrooksuk
Copy link
Member

I'm investigating this now.

Can you run sqlite3 and then PRAGMA compile_options; and paste the output here, please.

@sajaddp
Copy link
Author

sajaddp commented Nov 7, 2022

@jbrooksuk

ATOMIC_INTRINSICS=1
BUG_COMPATIBLE_20160819
CCCRYPT256
COMPILER=clang-14.0.0
DEFAULT_AUTOVACUUM
DEFAULT_CACHE_SIZE=2000
DEFAULT_CKPTFULLFSYNC
DEFAULT_FILE_FORMAT=4
DEFAULT_JOURNAL_SIZE_LIMIT=32768
DEFAULT_LOOKASIDE=1200,102
DEFAULT_MEMSTATUS=0
DEFAULT_MMAP_SIZE=0
DEFAULT_PAGE_SIZE=4096
DEFAULT_PCACHE_INITSZ=20
DEFAULT_RECURSIVE_TRIGGERS
DEFAULT_SECTOR_SIZE=4096
DEFAULT_SYNCHRONOUS=2
DEFAULT_WAL_AUTOCHECKPOINT=1000
DEFAULT_WAL_SYNCHRONOUS=1
DEFAULT_WORKER_THREADS=0
ENABLE_API_ARMOR
ENABLE_BYTECODE_VTAB
ENABLE_COLUMN_METADATA
ENABLE_DBPAGE_VTAB
ENABLE_DBSTAT_VTAB
ENABLE_EXPLAIN_COMMENTS
ENABLE_FTS3
ENABLE_FTS3_PARENTHESIS
ENABLE_FTS3_TOKENIZER
ENABLE_FTS4
ENABLE_FTS5
ENABLE_LOCKING_STYLE=1
ENABLE_NORMALIZE
ENABLE_PREUPDATE_HOOK
ENABLE_RTREE
ENABLE_SESSION
ENABLE_SNAPSHOT
ENABLE_SQLLOG
ENABLE_STMT_SCANSTATUS
ENABLE_UNKNOWN_SQL_FUNCTION
ENABLE_UPDATE_DELETE_LIMIT
HAS_CODEC_RESTRICTED
HAVE_ISNAN
MALLOC_SOFT_LIMIT=1024
MAX_ATTACHED=10
MAX_COLUMN=2000
MAX_COMPOUND_SELECT=500
MAX_DEFAULT_PAGE_SIZE=8192
MAX_EXPR_DEPTH=1000
MAX_FUNCTION_ARG=127
MAX_LENGTH=2147483645
MAX_LIKE_PATTERN_LENGTH=50000
MAX_MMAP_SIZE=1073741824
MAX_PAGE_COUNT=1073741823
MAX_PAGE_SIZE=65536
MAX_SQL_LENGTH=1000000000
MAX_TRIGGER_DEPTH=1000
MAX_VARIABLE_NUMBER=500000
MAX_VDBE_OP=250000000
MAX_WORKER_THREADS=8
MUTEX_UNFAIR
OMIT_AUTORESET
OMIT_LOAD_EXTENSION
STMTJRNL_SPILL=131072
SYSTEM_MALLOC
TEMP_STORE=1
THREADSAFE=2
USE_URI

@jbrooksuk
Copy link
Member

So the ENABLE_DBSTAT_VTAB is enabled, which is needed to use dbstat.

What I can't yet figure out is why this query doesn't work from here, but works if you use sqlite3 and run the same query...

@jbrooksuk
Copy link
Member

jbrooksuk commented Nov 7, 2022

Little bit more information... If I add this to getSqliteTableSize:

collect($connection->select('pragma compile_options;'))->pluck('compile_options')->values()->dd();

I can't see ENABLE_DBSTAT_VTAB is enabled:

array:46 [ // /Users/james/Code/laravel/framework/src/Illuminate/Database/Console/DatabaseInspectionCommand.php:154
  0 => "ATOMIC_INTRINSICS=1"
  1 => "COMPILER=clang-13.1.6"
  2 => "DEFAULT_AUTOVACUUM"
  3 => "DEFAULT_CACHE_SIZE=-2000"
  4 => "DEFAULT_FILE_FORMAT=4"
  5 => "DEFAULT_JOURNAL_SIZE_LIMIT=-1"
  6 => "DEFAULT_MMAP_SIZE=0"
  7 => "DEFAULT_PAGE_SIZE=4096"
  8 => "DEFAULT_PCACHE_INITSZ=20"
  9 => "DEFAULT_RECURSIVE_TRIGGERS"
  10 => "DEFAULT_SECTOR_SIZE=4096"
  11 => "DEFAULT_SYNCHRONOUS=2"
  12 => "DEFAULT_WAL_AUTOCHECKPOINT=1000"
  13 => "DEFAULT_WAL_SYNCHRONOUS=2"
  14 => "DEFAULT_WORKER_THREADS=0"
  15 => "ENABLE_COLUMN_METADATA"
  16 => "ENABLE_FTS3"
  17 => "ENABLE_FTS3_PARENTHESIS"
  18 => "ENABLE_FTS4"
  19 => "ENABLE_FTS5"
  20 => "ENABLE_GEOPOLY"
  21 => "ENABLE_MATH_FUNCTIONS"
  22 => "ENABLE_PREUPDATE_HOOK"
  23 => "ENABLE_RTREE"
  24 => "ENABLE_SESSION"
  25 => "MALLOC_SOFT_LIMIT=1024"
  26 => "MAX_ATTACHED=10"
  27 => "MAX_COLUMN=2000"
  28 => "MAX_COMPOUND_SELECT=500"
  29 => "MAX_DEFAULT_PAGE_SIZE=8192"
  30 => "MAX_EXPR_DEPTH=1000"
  31 => "MAX_FUNCTION_ARG=127"
  32 => "MAX_LENGTH=1000000000"
  33 => "MAX_LIKE_PATTERN_LENGTH=50000"
  34 => "MAX_MMAP_SIZE=0x7fff0000"
  35 => "MAX_PAGE_COUNT=1073741823"
  36 => "MAX_PAGE_SIZE=65536"
  37 => "MAX_SQL_LENGTH=1000000000"
  38 => "MAX_TRIGGER_DEPTH=1000"
  39 => "MAX_VARIABLE_NUMBER=250000"
  40 => "MAX_VDBE_OP=250000000"
  41 => "MAX_WORKER_THREADS=8"
  42 => "MUTEX_PTHREADS"
  43 => "SYSTEM_MALLOC"
  44 => "TEMP_STORE=1"
  45 => "THREADSAFE=1"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants