Skip to content

SQL schema files - duplicate column names #11

@rokf

Description

@rokf

Hello,

We've noticed that some (PostgreSQL) SQL schema files contain duplicate column names - Type and type in case of the Agent table.

CREATE TYPE Agent_type AS ENUM ('Agent');
CREATE TABLE Agent (Type TEXT, address JSON, areaServed TEXT, id TEXT PRIMARY KEY, location JSON, name JSON, type Agent_type);

Out of the box such a SQL statement won't work - it'll report a duplicate column name. Quoting both type columns so that they become "Type" and "type" seems to fix the issue in PostgreSQL. DuckDB doesn't seem to support this even with the quoted column names, even though it's trying to be compatible with PostgreSQL.

By the way, are the type columns and single type enums in Smart Data Model SQL schema files even necessary since the same value is also used for the table names? Removing them could be a possible solution for this issue and make the SQL schema files work in multiple (somewhat PostgreSQL compatible) databases, not just PostgreSQL.

Thanks!

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