sqlitebrowser / sqlitebrowser/sqlitebrowser

[Bug]: PRAGMA foreign_keys = ON; fails with "Execution aborted by user" on a new database

Open
#3,938 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
24.6k
Forks
2.4k
Avg merge
3d 49m
Merged PRs (30d)
3

Description

What did you do?
  1. Launched DB Browser for SQLite.
  2. Created a new, empty database (File -> New Database, saved as test.db).
  3. Navigated to the "Execute SQL" tab.
  4. Executed the following SQL statement:

PRAGMA foreign_keys = ON;

What did you expect to see?

I expected the command to execute successfully, typically indicated by a message like "Query executed successfully" in the status bar, and for foreign key enforcement to be enabled for the current database connection. No error messages should appear.

What did you see instead?

The command failed, and the following error message was displayed in the "Execute SQL" log/output area:

Execution finished with errors.
Result: Execution aborted by user
At line 1:
PRAGM

This occurred without any manual user intervention to abort the query. The same behaviour persists even after:

  • Restarting the application.
  • Restarting the computer.
  • Attempting this on a completely fresh database instance.
  • Reinstalling DB Browser for SQLite / Trying a portable version]

This issue prevents the proper use and testing of foreign key constraints. Further attempts to use commands like PRAGMA foreign_key_check; also fail, often with a "foreign key mismatch" error, even on an empty database or a database where such mismatches should not exist, presumably because foreign_keys could not be enabled correctly.

DB4S Version

3.13.1

What OS are you seeing the problem on?

Windows

OS version

Windows 11 Pro (Version 24H2, OS build 26100.3775)

Relevant log output
Execution finished with errors.
Result: Execution aborted by user
At line 1:
PRAGM
Prevention against duplicate issues
  • I have searched for similar issues

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure in DB Browser for SQLite 3.13.1 on Windows 11 with a newly created database, starting with PRAGMA foreign_keys = ON; and then PRAGMA foreign_key_check;. Trace how Execute SQL reports the statement result and determine what change makes the pragma succeed without user cancellation; done means the command completes successfully on an empty database and foreign-key checking behaves normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, sqlite
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.