Skip site navigation (1) Skip section navigation (2)

Re: Domain Support -- another round

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Rod Taylor" <rbt(at)zort(dot)ca>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>,pgsql-patches(at)postgresql(dot)org,"Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: Domain Support -- another round
Date: 2002-03-20 20:08:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
I've committed a bunch of changes after code review of your DOMAIN
patch.  There were a number of minor bugs as well as some stylistic
things I didn't like.

Probably the largest change was that I concluded we had to revert the
handling of default values for base types to the old way: simple literal
stored as a string.  You can't meaningfully deal with an expression that
represents a value of a type you haven't defined yet --- since you
surely haven't defined any functions or operators that yield it, either.
Therefore the apparent flexibility is illusory.  Also, the code just
plain didn't work: after I fixed preptlist.c to do what it should be
doing, I was getting "can't coerce" failures in the create_type
regression test.  (For example, it didn't believe that an int4 literal
"42" was a valid default for the test's type int42, which is correct
given that the test doesn't define any conversion function...)  So all
in all I just don't see any way that can work.  I've set it up so that
you can have *either* an expression default (if typdefaultbin is not
null) *or* a simple literal default (if typdefaultbin is null but
typdefault isn't).  The former case will work for domains, the latter
for base types.

There are still some things that need to be worked on:

1. pg_dump.  We *cannot* release this feature in 7.3 if there's not
pg_dump support for it.

2. Arrays.  I don't much care for the fact that arrays of domain-type
values aren't supported.  The handling of domains that are themselves
arrays seems a tad odd as well: the array-ish nature of the domain is
exposed, which doesn't make a lot of sense to me.  Perhaps we'd be
better off to forbid array domains.

3. Domains on domains.  Why shouldn't I be able to make a domain that's
a further restriction of another domain?

4. CHECK constraints for domains (which after all is the real point,

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2002-03-20 20:24:52
Subject: Re: Domains and type coercion
Previous:From: Peter EisentrautDate: 2002-03-20 19:47:59
Subject: Re: Proposal: 7.2b2 today

pgsql-patches by date

Next:From: Bruce MomjianDate: 2002-03-20 20:25:13
Subject: Re: [HACKERS] Fixes gram.y
Previous:From: Tom LaneDate: 2002-03-20 19:47:56
Subject: Re: [HACKERS] Fixes gram.y

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group