[CBRD-24880] semantic check for remote table column names and aliases #4477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
http://jira.cubrid.org/browse/CBRD-24880
It needs to check semantic for rewriting correctly the query with predicate pushing.
The dblink query can be rewritten by pushing predicates to enhance the performance. The query is rewritten by wrapping the user's query with "SELECT * FROM". While the rewriting processing it needs check the column names and aliases wether they are the same as DBLINK column definition's one.
For example, the following query is rewritten and the rewritten query returns error from the ORACLE server.
SELECT t.a, t.c FROM DBLINK(srv1, 'SELECT a, b AS p FROM t1 WHERE a > 10') t(a, c) JOIN tbl ON t.a = tbl.a WHERE c > 'a';
==> rewritten query to be executed at remote server (ORACLE or otheer DBMS)
SELECT * FROM (SELECT a, b AS p FROM t1 WHERE a > 10) cublink (a, c) WHERE c > 'a'
The query should be rewritten as below:
SELECT * FROM (SELECT a, b AS p FROM t1 WHERE a > 10) cublink WHERE p > 10