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

Incorrect operation of begin...end query #926

Open
klaseca opened this issue Jan 27, 2025 · 1 comment
Open

Incorrect operation of begin...end query #926

klaseca opened this issue Jan 27, 2025 · 1 comment
Assignees
Labels
bug 🪲 Something isn't working SQLite 🪶

Comments

@klaseca
Copy link

klaseca commented Jan 27, 2025

Describe the bug
Unable to create a trigger with syntax begin...end

To Reproduce
Steps to reproduce the behavior:

  1. Create sqlite database
  2. Create table:
create table
  test (
    id integer primary key,
    description text,
    updated_at text not null default current_timestamp
  );
  1. Try create trigger:
create TRIGGER tg_test_updated_at_update after
update on test for each row begin
update test
set
  updated_at = current_timestamp
where
  id = old.id;
end;
  1. Get error: SqliteError: incomplete input

Expected behavior
Trigger created

Application (please complete the following information):

  • App client: sqlite
  • App version 0.7.30
  • Installation source: exe

Environment (please complete the following information):

  • OS name: Windows 10
  • OS version: 22H2
  • DB name: sqlite
  • DB version: 3.45.3

Additional context
As I understand it, this is where query string is splitting. Trigger creation code is splitting into 2 lines, which results in an error

Example of splitting

[
  'CREATE TRIGGER tg_test_updated_at_update\n' +
    '    AFTER UPDATE\n' +
    '    ON test\n' +
    '    FOR EACH ROW\n' +
    'BEGIN\n' +
    '    UPDATE test\n' +
    '    SET updated_at = current_timestamp\n' +
    '    WHERE id = old.id',
  'END'
]
@Fabio286
Copy link
Member

Yes, the problem in this case is because the queries are split by ; to display the results separately.
Probably the best solution is to implement an option to disable automatic splits.
Currently the solution to the problem would be to create the trigger via GUI.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working SQLite 🪶
Projects
Status: 📌 To do
Development

No branches or pull requests

2 participants