Skip to content

Invalid statement ordering with CREATE DOMAIN CHECK constraints with function references #254

@alecthomas

Description

@alecthomas

Absolutely loving pgschema, thank you!

I'm using typeid to provide type safe ID's all the way down to the database. Unfortunately pgschema doesn't seem to correctly order statements when a function is referenced in a CREATE DOMAIN CHECK constraint. To use typeid you create a new domain like so:

CREATE DOMAIN user_id AS typeid CHECK (typeid_check(value, 'user'));

CREATE TABLE example (
    id user_id NOT NULL PRIMARY KEY
);

However, as can be seen in this example run, both the CREATE DOMAIN and CREATE TABLE are reordered before the required function is defined, as can be seen in the ordering of the original SQL.

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