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

Wrong syntax with CREATE TRIGGER ... ON <table> used with POSITION [CORE5545] #5813

Closed
firebird-automations opened this issue May 18, 2017 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @asfernandes

I understand that "ON <table>" is complement part to BEFORE INSERT, so POSITION must be after both, not in the middle.

Test case:

recreate table t (n integer);

-- works
recreate trigger t1 before insert position 1 on t as begin end;

-- don't work
recreate trigger t1 before insert on t position 1 as begin end;

Commits: 92be5d3

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Although you are right, please ensure this is fixed in a backwards compatible way, as this has been this way since the introduction of SQL:2003-style create trigger in Firebird 2.1

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Clauses could be made to be anywhere, but definitelly it would be wrong to have POSITION in the middle of something.

My opinion is to fix the error in v4. People should test their applications when migrating major versions and DDL is more flexible to changes.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

It seems that now one can NOT to use old syntax of [re]create trigger DDL.

This is what i see in the build of 24-may-2017:

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\FB40Cs\isql /:e40 -z -i c5545.sql
ISQL Version: WI-T4.0.0.651 Firebird 4.0 Unstable
Server version:
WI-T4.0.0.651 Firebird 4.0 Unstable
WI-T4.0.0.651 Firebird 4.0 Unstable/tcp (csprog)/P16
WI-T4.0.0.651 Firebird 4.0 Unstable/tcp (csprog)/P16

recreate table test\(id int\);

\-\- worked always:
recreate trigger test\_bi before insert
                 position 1
                 on test
as begin end;

-- did NOT work before fix core-5545, must work now:
recreate trigger test_bi before insert
on test
position 1
as begin end;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 3, column 21
-position
At line 13 in file c5545.sql

(and this is expected on THAT build)

But on current build (19-jun-2017) we have:

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\FB40\isql /:e40 -z -i c5545.sql
ISQL Version: WI-T4.0.0.680 Firebird 4.0 Alpha 1
Server version:
WI-T4.0.0.680 Firebird 4.0 Alpha 1
WI-T4.0.0.680 Firebird 4.0 Alpha 1/tcp (csprog)/P16
WI-T4.0.0.680 Firebird 4.0 Alpha 1/tcp (csprog)/P16

recreate table test\(id int\);

\-\- worked always:
recreate trigger test\_bi before insert
                 position 1
                 on test
as begin end;

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 2, column 22
-position
At line 6 in file c5545.sql

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Deferred

Test Details: See comment 22/Jun/17 05:11 AM

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Deferred => Done successfully

Test Details: See comment 22/Jun/17 05:11 AM =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

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