Skip to content

“number” in column comment causes datatype to be set as NUMBER #86

Description

@neilfernandez

Description:
When defining a table in QuickSQL, the presence of the word “number” in a column comment causes the column’s datatype to change to NUMBER, even when a string type was specified.

Example:

my_table
    org_no                   vc11                    [Swedish organization number XXXXXX-XXXX.]
    vat_nr                   vc20                    [VAT number for non swedish companies.]

Generated SQL:

create table my_table (
    id        number default on null to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') 
              constraint my_table_id_pk primary key,
    org_no    number,
    vat_nr    number
);

comment on column my_table.org_no is 'Swedish organization number XXXXXX-XXXX.';
comment on column my_table.vat_nr is 'VAT number for non swedish companies.';

Expected Behavior:
The datatypes for org_no and vat_nr should remain VARCHAR2(11) and VARCHAR2(20) respectively, regardless of the comment text.

Actual Behavior:
QuickSQL changes both columns to NUMBER due to the word “number” appearing in the comment.

Notes:

  • Reproducible in current QuickSQL parser.
  • Trigger condition: the token number in a comment is likely being misinterpreted as a type indicator.
  • May require disambiguation between comment text and type inference tokens.

Reported by: Mathias Magnusson mathias.magnusson@gmail.com

Activity

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

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