Skip to content

Support PostgreSQL DOMAINs #1796

Open
Open

Description

@janpio

https://www.postgresql.org/docs/9.5/sql-createdomain.html

A domain is essentially a data type with optional constraints (restrictions on the allowed set of values).

Example:

CREATE DOMAIN year AS integer
	CONSTRAINT year_check CHECK (((VALUE >= 1901) AND (VALUE <= 2155)));

From: https://github.com/prisma/database-schema-examples/blob/master/postgres/sakila/schema.sql


Test Utils database affected:

  • postgres/sakila

Activity

  1. DamodarSojka commented on Mar 17, 2023

    @DamodarSojka

    Just hit that.

    CREATE DOMAIN percent_max_100
        AS DOUBLE PRECISION
        CONSTRAINT max_100 CHECK ( value <= 100 )
    

    Correctly mapped to Float by prisma during introspection.

    However when issuing a query to set the value "incorrect binary data format in bind parameter X"

    Would be good to at least have the documentation mention NOT to use domain. Or even better, the introspection warning about it, or not generate the mapping for the column. (Sorry if I missed it!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions