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

Column lookup for tables is not escaping wildcards #136

Closed
exaSR opened this issue Feb 23, 2023 · 2 comments · Fixed by #139
Closed

Column lookup for tables is not escaping wildcards #136

exaSR opened this issue Feb 23, 2023 · 2 comments · Fixed by #139
Assignees
Labels
bug Unwanted / harmful behavior

Comments

@exaSR
Copy link
Collaborator

exaSR commented Feb 23, 2023

(again tested using exasol dialect, but is jdbc standard problem)

setup

create schema VSA;
CREATE JAVA ADAPTER SCRIPT VSA.EXASOL_ADAPTER AS
    %scriptclass com.exasol.adapter.RequestDispatcher;
    %jar /buckets/bfsdefault/default/virtual-schema-dist-10.1.0-exasol-7.0.2.jar;
/


create or replace connection LOCAL_JDBC
to 'jdbc:exa:localhost/<fingerprint>:8563'
user 'sys' identified by 'secret';


create schema mixup;
create table HELLO_WORLD(i int);
create table "HELLOxWORLD"(x int);


CREATE VIRTUAL SCHEMA mixed_up
USING VSA.EXASOL_ADAPTER WITH
    CONNECTION_NAME = 'LOCAL_JDBC'
    SCHEMA_NAME     = 'MIXUP'
;

Bug: Column lookup passes 'HELLO_WORLD' to jdbc's getColumns() call, which is interpreted as SQL wildcard

describe mixed_up."HELLO_WORLD";

returns

COLUMN_NAME SQL_TYPE      
----------- ------------- 
I           DECIMAL(18,0) 
X           DECIMAL(18,0) 

Of course, column X is not really there and any access will result in errors.

On top of that, neither the VS adapter nor the database backend checks for duplicate column names...

@exaSR exaSR added the bug Unwanted / harmful behavior label Feb 23, 2023
@ckunki
Copy link
Collaborator

ckunki commented Mar 8, 2023

Hello @exaSR @redcatbear and me have the same assumption:

  • VSCJDBC asks JDBC driver for column metadata and provides the table name, potentially containing wildcards
  • Method getColumns() in JDBC driver accepts wildcards and simply returns all matching tables or all columns of all matching tables

Proposed change

  • update VSCJDBC to escape potential wildcards before asking the JDBC driver

@ckunki
Copy link
Collaborator

ckunki commented Mar 9, 2023

I will add a test in VSEXA, see exasol/exasol-virtual-schema#94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted / harmful behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants