Re: I need help creating a composite type with some sort of constraints. - Mailing list pgsql-general

From Scott Bailey
Subject Re: I need help creating a composite type with some sort of constraints.
Date
Msg-id 4B0B117B.5000709@comcast.net
Whole thread Raw
In response to I need help creating a composite type with some sort of constraints.  (John Oyler <john.m.oyler@gmail.com>)
List pgsql-general
John Oyler wrote:
> I can create one or more domains, and use those to create the
> composite type from. But each domain can only be constrained in its
> own value, I can't constrain element #1's value based on what element
> #2's value is.
>
> If I create a domain from a composite, it will complain with a "ERROR:
> cdt.instant_message is not a valid base type for a domain" error.
>
> I can't create a trigger for a composite either (technically it's not
> a table, but I was hoping it might be treated as one internally).
>
> Is there any way to do this? Are there any plans to change or expand
> this functionality in the future?
>
> Thanks,
> John O.

For now you have to put all checks in custom constructor functions.

Scott


pgsql-general by date:

Previous
From: Alan Hodgson
Date:
Subject: Re: get a log of queries that take up a lot of CPU or take a very long time.
Next
From: Kris Gale
Date:
Subject: Multicolumn index including tsvector.