X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 03ED99DCC4A for ; Mon, 28 Nov 2005 20:06:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71660-03 for ; Mon, 28 Nov 2005 20:06:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gatekeeper.look.ca (gamma1.look.ca [207.136.80.8]) by postgresql.org (Postfix) with ESMTP id 6D0599DCC11 for ; Mon, 28 Nov 2005 20:06:12 -0400 (AST) Received: from 216-154-14-116.dsl.look.ca ([216.154.14.116]) by gatekeeper.look.ca with esmtp (Exim 4.20) id 1Egr0s-0002Dq-Or; Mon, 28 Nov 2005 21:58:18 +0000 From: Rod Taylor To: Announce Cc: pgsql-sql@postgresql.org In-Reply-To: References: Date: Mon, 28 Nov 2005 16:57:55 -0500 Message-Id: <1133215075.69767.30.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 FreeBSD GNOME Team Port X-SA-Exim-Mail-From: pg@rbt.ca Subject: Re: DEFAULT Constraint based on table type? Content-Type: text/plain Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 3.1 (built Tue Feb 24 05:09:27 GMT 2004) X-SA-Exim-Scanned: Yes X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/264 X-Sequence-Number: 23515 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) --