Re: Pulling data from a constraint def - Mailing list pgsql-general

From David Fetter
Subject Re: Pulling data from a constraint def
Date
Msg-id 20100512045800.GG22644@fetter.org
Whole thread Raw
In response to Pulling data from a constraint def  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Responses Re: Pulling data from a constraint def
List pgsql-general
On Tue, May 11, 2010 at 06:38:59PM -0700, Gauthier, Dave wrote:
> Hi:
>
> I have a constraint defined on a table....
>
> constraint design_style_is_invalid check (design_style in
> ('rls','sdp','rf','ssa','rom','rpt','analog','sdprpt','clkdist','global')),
>
> Is there a way to get the valid values in the list from the metadata
> somehow?

There may be, but you're much better off either creating a small table
design_style with one column of text and making foreign key references
to it.

> Specifically, when someone hits this constraint, I want to
> not oonly tell them they entered an invalid value, but give them the
> list of valid choices at the same time.
>
> I'd rather not put these in a table and implement with a foreogn key
> constraint for performance reasons. (Does that make sense?)

If you've measured a performance issue for a table that tiny, it's a
bug that needs fixing in PostgreSQL.  What measurements have you done
so far?

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

pgsql-general by date:

Previous
From: Sergey Konoplev
Date:
Subject: Re: can function arguments have the type tablename.columnname%TYPE?
Next
From: "A. Kretschmer"
Date:
Subject: Re: Pulling data from a constraint def