Skip to content

Quoter identifiers in QSQL are concatenated incorrectly #21

@vadim-tropashko

Description

@vadim-tropashko

Quoted identifiers example from small_tests.js:

output = quicksql.toDDL( 
        `"Test" 
            "CamelCase"
            x   [coMment]  
            2   --coMment2  
    `);

//console.log(output);
assert( " 0 < output.indexOf('create table \"Test\"') " );                                     
//assert( " 0 < output.indexOf('Test_id_pk') " );                                     
assert( " 0 < output.indexOf('\"CamelCase\"') " );                                     
assert( " 0 < output.indexOf('comment on column \"Test\".x is ') " );                                     
assert( " 0 < output.indexOf('comment on column \"Test\".x2 is ') " );   

The second, commented out assertion is broken. The full output is:

create table "Test" (
    id             number generated by default on null as identity
                   constraint "Test"_id_pk primary key,   -- broken
    "CamelCase"    varchar2(4000 char),
    x              varchar2(4000 char),
    x2             varchar2(4000 char)
);

comment on column "Test".x is 'coMment';

Presumably, there is a bug everywhere in the code where the name is concatenated. I suggest introducing a dedicated concat method which would handle quoted identifiers correctly.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions