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-issue-importer opened this issue Jun 9, 2007 · 16 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Jun 9, 2007

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 15, 2007

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 15, 2007

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 15, 2007

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.1 Beta 1 [ 10141 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 15, 2007

Commented by: Alexander Tyutik (tut)

Adriano, what did you meen about diffirent tables?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 16, 2007

Commented by: @asfernandes

Second part of the fix is committed.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 16, 2007

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 16, 2007

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 16, 2007

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 20, 2007

Modified by: @pcisar

Link: This issue is related to QA139 [ QA139 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 25, 2007

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 25, 2007

Modified by: @pcisar

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 28, 2008

Modified by: @pcisar

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 2, 2008

Commented by: @hvlad

Backported into 2.0.5

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 2, 2008

Modified by: @hvlad

Fix Version: 2.0.5 [ 10222 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants