Re: Pulling data from a constraint def

From: David Fetter <david(at)fetter(dot)org>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Pulling data from a constraint def
Date: 2010-05-12 04:58:00
Message-ID: 20100512045800.GG22644@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2010-05-12 05:23:31 Re: Pulling data from a constraint def
Previous Message Sergey Konoplev 2010-05-12 04:54:36 Re: can function arguments have the type tablename.columnname%TYPE?