Missing quotes in some requests ?
pvdbk opened this issue · 0 comments
Used YesSql version : 3.5.0
We create tenants on Orchard, using Postgres and various table prefixes, like "1abcd". When one of these prefixes begin with a numeric characters, we get an error. Here is a part of the stack trace.
at YesSql.Sql.SchemaBuilder.Execute(IEnumerable1 statements) in YesSql.Sql\SchemaBuilder.cs:line 50
at YesSql.Sql.SchemaBuilder.CreateForeignKey(String name, String srcTable, String[] srcColumns, String destTable, String[] destColumns) in YesSql.Sql\SchemaBuilder.cs:line 245
at YesSql.Sql.SchemaBuilder.CreateMapIndexTable(Type indexType, Action1 table, String collection) in YesSql.Sql\SchemaBuilder.cs:line 74
More generally, in SchemaBuilder
, it seems that you can not call CreateMapIndexTable
when TablePrefix
begins with a digit.
Perhaps, this issue could be solved adding quotes to the Name
property of the various ISchemaCommand
treated in YesSql.Sql.BaseCommandInterpreter.Create
.
However, it would fix the SQL request generated in our case. Here is an exemple of a generated request with the lake of quotes :
alter table "1abcd_UserIndex" add constraint 1abcd_FK_UserIndex foreign key "DocumentId" references "1abcd_Document" ("Id")