Using Postgres domains to simplify function input validation
问题 Using Postgres 11.5, I've been looking at CREATE DOMAIN since yesterday, and would like to clarify how they can/can't help with function parameters. Ideally, I'd like to use a domain to screen parameter inputs easily, but with a helpful error response. As an example, I'm using a simple first-case, a domain that blocks null and empty strings: CREATE DOMAIN text_not_empty AS text NOT NULL CHECK (value <> ''); I tried this out as a field type for a table, and it's great. When we don't allow