0
Under review

Same table name with different schema name is not allowed

Ali Tabrizi 5 років тому оновлено David Henley 4 роки тому 2

We are having trouble with creating these two tables in the same model :

schema1.users

schema2.users



Under review

This is a bug and is not at the same time. Please let me explain.


You can set a schema name for a table in "Additional properties" section (available on the right-hand side after selecting a table). Now, when you create two tables "users" and set "Schema" properties as "schema1" and "schema2", then:

1) an error would be raised "Table name is not unique" - that's not true and this is a bug

2) if you generate SQL script, it will be valid:

-- tables
-- Table: users
CREATE TABLE schema1.users (
    id int  NOT NULL,
    CONSTRAINT users_pk PRIMARY KEY (id)
);

-- Table: users
CREATE TABLE schema2.users (
    id int  NOT NULL,
    CONSTRAINT users_pk PRIMARY KEY (id)
);


So only raising an error is our bug. You can still create tables and other objects in different schemas.

If you want, you can disable the validation of tables' names.