-
Notifications
You must be signed in to change notification settings - Fork 14
Description
When using QuickSQL to define a table with a 'check' constraint on a column, the generated SQL is malformed if the table name contains non-ASCII characters. Specifically, the generated constraint name includes an extra quotation mark, which can lead to syntax errors in the resulting SQL.
- Define a table in QuickSQL with only ASCII table and column names:
articles
id /pk
status int /check 1,2,3
The SQL created is:
create table articles (
id number default on null to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
constraint articles_id_pk primary key,
status integer constraint articles_status_ck
check (status in (1,2,3))
);
This is correct.
- Define a table in QuickSQL where the table name contains non-ASCII characters:
日本語
id /pk
status int /check 1,2,3
The SQL created is:
create table "日本語" (
id number default on null to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
constraint "日本語_id_pk" primary key,
status integer constraint "日本語"status_ck"
check (status in (1,2,3))
);
Note the malformed constraint name (constraint "日本語"status_ck"), which incorrectly mixes quoted and unquoted identifiers, and includes an extra quotation mark.
The constraint names should be correctly formed regardless of whether the table name contains ASCII or non-ASCII characters. For example:
status integer constraint "日本語_status_ck"
check (status in (1,2,3))
This bug may cause SQL execution failures when using non-ASCII table names in QuickSQL, impacting usability for users working with multilingual identifiers.