From: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
---|---|
To: | PgSQL General ML <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Domains (was Re: int1?) |
Date: | 2003-10-09 20:24:09 |
Message-ID: | 1065731049.1234.92.camel@haggis |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 2003-10-09 at 15:13, Bruno Wolff III wrote:
> On Thu, Oct 09, 2003 at 14:46:08 -0500,
> Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> wrote:
> > On Thu, 2003-10-09 at 14:46, Bruno Wolff III wrote:
> > > On Thu, Oct 09, 2003 at 14:28:57 -0500,
> > > Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> wrote:
> > > >
> > > > http://www.postgresql.org/docs/7.3/static/sql-createdomain.html
> > > > CREATE DOMAIN domainname [AS] data_type
> > > > [ DEFAULT default_expr ]
> > > > [ constraint [, ... ] ]
> > > >
> > > > where constraint is:
> > > >
> > > > [ CONSTRAINT constraint_name ]
> > > > { NOT NULL | NULL }
> > > >
> > > > test1=# create domain d_tinyint as smallint constraint chk_tinyint CHECK (smallint between 0 and 255);
> > > > ERROR: DefineDomain: CHECK Constraints not supported
> > > >
> > > > So, how would I create a domain that limits a smallint?
> > >
> > > You need to use 7.4. In 7.3 you couldn't use check constraints with domains.
> >
> > So is there a documentation "bug", or, what kind of constraints
> > can be placed on domains besides { NOT NULL | NULL }?
>
> I think the documentation is correct. As I read it it says that only NOT NULL
> and NULL constraints are allowed. This is easy to overlook. I know I got
> caught by this when I tried it.
test1=# create domain foo as smallint not null;
CREATE DOMAIN
test1=# create domain bar as smallint CONSTRAINT wiggle not null;
CREATE DOMAIN
Oh, ok. Stuff in [] is not necessary. Still confusing.
--
-----------------------------------------------------------------
Ron Johnson, Jr. ron(dot)l(dot)johnson(at)cox(dot)net
Jefferson, LA USA
The difference between drunken sailors and Congressmen is that
drunken sailors spend their own money.
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2003-10-09 20:36:05 | Re: int1? |
Previous Message | Bruno Wolff III | 2003-10-09 20:20:16 | Re: Parent Id |