Thread: Is "CREATE DOMAIN" in 6.3 ??

Is "CREATE DOMAIN" in 6.3 ??

From
al dev
Date:
Hi:
Is create domain command implemented in 6.3??
I am trying to use
  create domain employed as char(10)
  check (
value = "YES" or
value = "NO" or
value = "RETIRED" or
value = "DISABLED" or
value is NULL
);
in SQL scripts but is failing in 6.2.1 postgresql.

I can find work around BUT there are tons of create domains in my SQL
scripts and will be very tedious.
By the way, create domain is in defined in SQL 92
see this chapter 42 in
http://sunsite.unc.edu/LDP/HOWTO/Database-HOWTO.html

al
"This world is wasting billions of dollars and millions manhours
re-inventing the TECHNOLOGY WHEELS!!"
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: [HACKERS] Is "CREATE DOMAIN" in 6.3 ??

From
The Hermit Hacker
Date:
On Sat, 28 Feb 1998, al dev wrote:

> Hi:
> Is create domain command implemented in 6.3??
> I am trying to use
>   create domain employed as char(10)
>   check (
> value = "YES" or
> value = "NO" or
> value = "RETIRED" or
> value = "DISABLED" or
> value is NULL
> );
> in SQL scripts but is failing in 6.2.1 postgresql.
>
> I can find work around BUT there are tons of create domains in my SQL
> scripts and will be very tedious.
> By the way, create domain is in defined in SQL 92
> see this chapter 42 in
> http://sunsite.unc.edu/LDP/HOWTO/Database-HOWTO.html

    I took a look here, and it didn't say (at least not in chapter
42)...what exactly does 'create domain' do?  We don't, and won't, have it
for v6.3, not with a release in a few days, and since I do recall anyone
else having mentioned it before, it isn't on our TODO list, but sounds
like something else to be added...

    But, a short description of what it does would be nice, as I've
never heard of that one before :)

Marc G. Fournier
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


Re: [QUESTIONS] Re: [HACKERS] Is "CREATE DOMAIN" in 6.3 ??

From
Herouth Maoz
Date:
At 22:10 +0200 on 28/2/98, The Hermit Hacker wrote:

>     I took a look here, and it didn't say (at least not in chapter
> 42)...what exactly does 'create domain' do?  We don't, and won't, have it
> for v6.3, not with a release in a few days, and since I do recall anyone
> else having mentioned it before, it isn't on our TODO list, but sounds
> like something else to be added...
>
>     But, a short description of what it does would be nice, as I've
> never heard of that one before :)

The idea, I think, is to define datatypes so that fields which are supposed
logically to be of the same kind will all have the same domain. Thus, if
the domain is later changed (say, implementation is changed from money to
float), all fields defined that way are changed together.

This is from SQL 1992:

    A domain is a set of permissible values. A domain is defined in
    a schema and is identified by a <domain name>. The purpose of a
    domain is to constrain the set of valid values that can be stored
    in SQL-data by various operations.

    A domain definition specifies a data type. It may also specify a
    <domain constraint> that further restricts the valid values of the
    domain and a <default clause> that specifies the value to be used
    in the absence of an explicitly specified value or column default.

    A domain is described by a domain descriptor. A domain descriptor
    includes:

    -  the name of the domain;

    -  the data type descriptor of the data type of the domain;

    -  the <collation name> from the <collate clause>, if any, of the
       domain;

    -  the value of <default option>, if any, of the domain; and

    -  the domain constraint descriptors of the domain constraints, if
       any, of the domain.

The syntax:

    <domain definition> ::=
         CREATE DOMAIN <domain name> [ AS ] <data type>
           [ <default clause> ]
           [ <domain constraint>... ]
           [ <collate clause> ]

    <domain constraint> ::=
         [ <constraint name definition> ]
         <check constraint definition> [ <constraint attributes> ]

I won't quote the entire syntax rules from SQL 1992 - I'm sure someone out
there has a copy. In any case, this is NOT Entry-Level SQL 1992, but rather
Intermediate Level.

Herouth