Re: DEFAULT Constraint based on table type?

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Announce <truthhurts(at)insightbb(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: DEFAULT Constraint based on table type?
Date: 2005-11-28 21:57:55
Message-ID: 1133215075.69767.30.camel@home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, 2005-11-28 at 14:22 -0600, Announce wrote:
> Lets say I have the following tables.
>
> CREATE TABLE animals(id primary key, name varchar, type varchar);
> CREATE TABLE dogs (breed varchar) INHERITS (animals);
> CREATE TABLE birds (bool hasFeathers) INHERITS (animals);

r=# alter table birds alter type set default 'Bird';
ALTER TABLE
r=# \d birds
Table "public.birds"
Column | Type | Modifiers
-------------+-------------------+-----------------------------------
id | integer | not null
name | character varying |
type | character varying | default 'Bird'::character varying
hasfeathers | boolean |
Inherits: animals

r=# \d animals
Table "public.animals"
Column | Type | Modifiers
--------+-------------------+-----------
id | integer | not null
name | character varying |
type | character varying |
Indexes:
"animals_pkey" PRIMARY KEY, btree (id)

--

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jaime Casanova 2005-11-28 22:14:15 Re: DEFAULT Constraint based on table type?
Previous Message Announce 2005-11-28 20:22:49 DEFAULT Constraint based on table type?