Skip to content

Problem with attribute quoting in ddl generation for h2. #254

@motlin

Description

@motlin

After upgrading to the latest version of Reladomo, I see the new attribute quoting behavior. I'm generating ddl files to disk using the postgres database type, and then I load them into h2 inside tests. I realize this might not be a valid thing to do, but it's always worked in the past and CoreMithraDbDefinitionGenerator#setDatabaseType doesn't have an option for h2. Should it?

The quoting is happening a little differently in ddl files, idx files, and fk files.

In ddl files, the quotes appear escaped with slashes. H2 doesn't seem to like this syntax.

drop table if exists MYTYPE;

create table MYTYPE
(
    \"name\" varchar(256) not null,
    data varchar(100000) not null,
);

In fk files, there's no quoting. H2 is fine with this, at least for the identifier "name".

references MYTYPE(
    name
);

In idx files, there's quoting with no slashes. H2 is fine with this too.

alter table MYTYPE add constraint MYTYPE_PK primary key ("name");

I stepped through AbstractGeneratorDatabaseType a bit and see the places where getColumnNameWithEscapedQuote() and getPlainColumnName() are called, and I'm happy to help with a fix, but I'm not confident I understand the issue.

Metadata

Metadata

Assignees

No one assigned

    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