Re: [HACKERS] domain feature - details

From: Mattias Kregert <matti(at)algonet(dot)se>
To: al dev <aldevpgsql(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] domain feature - details
Date: 1998-03-06 10:40:38
Message-ID: 34FFD2A6.65A76761@algonet.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

al dev wrote:
>
> Hi all:
> More details on what domains are. Domains are global
> column definitions, upon which column definitions
> can be based. A domain specifies a data type, and a
> set of column attributes and constraints. Subsequent
> table definitions can use the domain to define columns.
>
> Here is the detail for 'ALTER DOMAIN' feature. I
> pulled this off the chapter 42 at
> http://sunsite.unc.edu/LDP/HOWTO/Database-HOWTO.html>
> <alter domain statement> ::=
> ALTER DOMAIN <domain name> <alter domain action>
>
> <alter domain action> ::=
> <set domain default clause>
> | <drop domain default clause>
> | <add domain constraint definition>
> | <drop domain constraint definition>

What happens if I change a DOMAIN after I have created tables with
it? Does CONSTRAINT's and DEFAULTS and TYPES change for those tables,
or should it only affect tables created after the change?

Suppose I do this:
1. I create DOMAIN for "Person", and create lots of tables with
Person columns.
2. After some weeks, I want to CONSTRAIN Person to disallow NULL
social security number, so I change the "Person" DOMAIN.

Do I have to re-create all tables, or will the change take effect
immediately? Will some changes take effect, like default and constraint,
but not the data type? Or will changes in data type cause the tables
to be modified? Will the database lock the tables and convert them
when I type the ALTER command?

/* m */

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mattias Kregert 1998-03-06 10:45:46 Re: [HACKERS] AUTO_INCREMENT suggestion
Previous Message Goran Thyni 1998-03-06 10:26:49 Re: [HACKERS] AUTO_INCREMENT suggestion