pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ken Hill <ken@scottshill.com>
To: Maciej Piekielniak <piechcio@isb.com.pl>
Cc: pgsql-sql@postgresql.org
Subject: Re: create table and data types
Date: Tue, 14 Feb 2006 13:30:34 -0800
Message-ID: <1139952634.3083.72.camel@localhost.localdomain> (raw)
In-Reply-To: <1827225102.20060214221218@isb.com.pl>
References: <1827225102.20060214221218@isb.com.pl>

On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote:

> Hello pgsql-sql,
> 
>   Is anybody know how create field in a new table with data type accuiring from a field in other table?
>   For example:
> 
> create table new_table
> ( 
>  name other_table.name%TYPE
> ); 
> 

Have you tried inheritance from one table to the new table?

CREATE TABLE new_table (new_column)
     INHERITS (old_table)

All columns in 'old_table' will be inclueded in 'new_table' plus the
column 'new_column'.

view thread (6+ messages)  latest in thread

Message-ID: <1139952634.3083.72.camel@localhost.localdomain>
Permalink:  ../1139952634.3083.72.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1139952634.3083.72.camel@localhost.localdomain

 · 

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: ken@scottshill.com, piechcio@isb.com.pl
  Subject: Re: create table and data types
  In-Reply-To: <1139952634.3083.72.camel@localhost.localdomain>

* 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