nakagami / firebirdsql

Firebird RDBMS sql driver for Go (golang)
MIT License
224 stars 60 forks source link

Unable to execute trigger sql or execute multiple queries at once #114

Closed minlau closed 1 year ago

minlau commented 3 years ago

I need an ability to execute multiple queries and pretty much any other queries(like create table, trigger and etc.) what I assume is not rare use case.

  1. Executing create trigger sql

    create trigger biu_parts for parts
    before insert or update
    as
    begin
    if (inserting and new.id is null)
    then new.id = gen_id(gen_partrec_id, 1);
    new.partname_upper = upper(new.partname);
    end

    returns error: "Metadata update statement is not allowed by the current database SQL dialect 1". I believe(99% sure) Upscene Database Workbench executes it with Dialect 1 without any problem.

  2. Adding TERM(various versions) to sql:

    SET TERM ^ ;
    [MY SQL]
    ^

    returns error: Token unknown - line 1, column 5 TERM Upscene Database Workbench executes it with Dialect 1 without any problem.

  3. Adding execute block to sql:

    execute block as begin
    select first 1 * from some_table;
    select first 1 * from some_table;
    end

    returns error: Token unknown - line 1, column 33 ; Did not try in Upscene Database Workbench.

From my personal experience some things in Firebird are more complicated compares to mysql/postgresql. Is this expected behavior? Or something is it just not implemented?