Skip to content

Correct db_type for overriding integers is confusing #421

Open
@kyleconroy

Description

@kyleconroy

Given the following schema:

CREATE TABLE foo (
    bar INTEGER NOT NULL
);

It would seem that the correct way to override the type for the bar column would be this:

overrides:
  - go_type: "example.com/some.Type"
    db_type: "integer"

Due to the SQL parser we use for Postgres, the column type is automatically converted into a canonical format. In this case, it translates integer to pg_catalog.int4. The correct configuration file is this:

overrides:
  - go_type: "example.com/some.Type"
    db_type: "pg_catalog.int4"

This is very confusing. We should probably attempt to canonicalize the db_type value the same way as the parser.

First reported in #412

Metadata

Metadata

Assignees

No one assigned

    Labels

    📚 postgresqlbugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions