named generic constraints [feature request]

From: Caleb Cushing <xenoterracide(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: named generic constraints [feature request]
Date: 2009-11-23 08:59:29
Message-ID: 81bfc67a0911230059j2c868e7dw860723f7a0ee3b83@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

So last time I checked this wasn't possible (at least not that anyone
has told me). I'd like to be able to create constraints that aren't
tied to a specific table/column.

I think that the syntax would look something like this

CREATE CONSTRAINT empty CHECK (VALUE = '\0' );

this should allow us to do thinks like

CREATE TABLE users (
username TEXT NOT empty
);

the example from create domain (modified) is also pretty good

CREATE CONSTRAINT zip CHECK(
VALUE ~ '^\\d{5}$'
OR VALUE ~ '^\\d{5}-\\d{4}$'
);

--
Caleb Cushing

http://xenoterracide.blogspot.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2009-11-23 09:17:29 Re: named generic constraints [feature request]
Previous Message Peter Eisentraut 2009-11-23 08:26:18 Re: Unicode UTF-8 table formatting for psql text output