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

RDB$DB_KEY not supported in derived tables and merge command [CORE1313] #1732

Closed
firebird-automations opened this issue Jun 9, 2007 · 16 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Alexander Tyutik (tut)

Is related to QA139

I've got error when trying to run queries like this:

SELECT T1.*
FROM TABLE T1
RIGHT JOIN (SELECT T.RDB$DB_KEY AS DBKEY FROM TABLE T) T2 ON T2.DBKEY = T1.RDB$DB_KEY;

or this:

MERGE INTO TABLE T1
USING (SELECT T.RDB$DB_KEY AS DBKEY FROM TABLE T) T2
ON T2.DBKEY = T1.RDB$DB_KEY
WHEN NOT MATCHED THEN INSERT ...

Error is something like this:

Column unknown.
T.DB_KEY.

Commits: 6dfc7f8 564c288 ea48ea8

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Compilation problem of MERGE with RDB$DB_KEY's should be solved now.
Issue in SELECT wasn't reproducable.

But anyway, your queries will not work well since it compare dbkeys from different tables. :-)

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.1 Beta 1 [ 10141 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Alexander Tyutik (tut)

Adriano, what did you meen about diffirent tables?

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Second part of the fix is committed.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

You're comparing T (or T2).RDB$DB_KEY with T1.RDB$DB_KEY.
DBKEY from one table will never be equal to DBKEY from another one.

@firebird-automations
Copy link
Collaborator Author

Commented by: Alexander Tyutik (tut)

But all T, T1 and T2 are aliases for same table "TABLE". Such queries can be used for some performance tricks. Is there are some problems with DB_KEYs in such cases?

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Your query confused-me, since it doesn't parse correctly.

You used the reserved word TABLE without double-quoted.
And I removed this thinking you meaning "select from the table ...".

Now I see there is a problem with RDB$DB_KEY and aliases, not only with derived tables.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA139 [ QA139 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

Fix verified for Beta 1, test added. Can't reproduce the issue with first query, but it was included in test anyway.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 12287 ] => Firebird [ 14792 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Backported into 2.0.5

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

Fix Version: 2.0.5 [ 10222 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test => Done successfully

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

No branches or pull requests

2 participants