pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <pg@rbt.ca>
To: Announce <truthhurts@insightbb.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: DEFAULT Constraint based on table type?
Date: Mon, 28 Nov 2005 16:57:55 -0500
Message-ID: <1133215075.69767.30.camel@home> (raw)
In-Reply-To: <KBEKKNMFLELKGIADDEPEMEBPCDAA.truthhurts@insightbb.com>
References: <KBEKKNMFLELKGIADDEPEMEBPCDAA.truthhurts@insightbb.com>

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)



-- 




view thread (5+ messages)  latest in thread

Message-ID: <1133215075.69767.30.camel@home>
Permalink:  ../1133215075.69767.30.camel@home/
Also on:    postgresql.org/message-id/1133215075.69767.30.camel@home

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pg@rbt.ca, truthhurts@insightbb.com
  Subject: Re: DEFAULT Constraint based on table type?
  In-Reply-To: <1133215075.69767.30.camel@home>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox