Re: create table and data types

From: Ken Hill <ken(at)scottshill(dot)com>
To: Maciej Piekielniak <piechcio(at)isb(dot)com(dot)pl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: create table and data types
Date: 2006-02-14 21:30:34
Message-ID: 1139952634.3083.72.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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'.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Maciej Piekielniak 2006-02-14 22:03:17 Re: create table and data types
Previous Message Ken Hill 2006-02-14 21:25:36 Re: Non Matching Records in Two Tables