Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PostgreSQL DOMAINs #1796

Open
Tracked by #16311
janpio opened this issue Mar 9, 2020 · 1 comment
Open
Tracked by #16311

Support PostgreSQL DOMAINs #1796

janpio opened this issue Mar 9, 2020 · 1 comment
Labels
domain/psl Issue in the "PSL" domain: Prisma Schema Language domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/feature A request for a new feature. topic: database-functionality topic: native database types topic: schema topic: test-utils topic: validation

Comments

@janpio
Copy link
Member

janpio commented Mar 9, 2020

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
@DamodarSojka
Copy link

DamodarSojka commented Mar 17, 2023

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
Labels
domain/psl Issue in the "PSL" domain: Prisma Schema Language domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/feature A request for a new feature. topic: database-functionality topic: native database types topic: schema topic: test-utils topic: validation
Projects
None yet
Development

No branches or pull requests

4 participants