Re: create table and data types - Mailing list pgsql-sql

From Ken Hill
Subject Re: create table and data types
Date
Msg-id 1139952634.3083.72.camel@localhost.localdomain
Whole thread Raw
In response to create table and data types  (Maciej Piekielniak <piechcio@isb.com.pl>)
Responses Re: create table and data types  (Maciej Piekielniak <piechcio@isb.com.pl>)
List pgsql-sql
On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: <blockquote type="CITE"><pre>
<font color="#000000">Hello pgsql-sql,</font>

<font color="#000000">  Is anybody know how create field in a new table with data type accuiring from a field in other
table?</font>
<font color="#000000">  For example:</font>

<font color="#000000">create table new_table</font>
<font color="#000000">( </font>
<font color="#000000"> name other_table.name%TYPE</font>
<font color="#000000">); </font>

</pre></blockquote> Have you tried inheritance from one table to the new table?<br /><br /> CREATE TABLE new_table
(new_column)<br/>      INHERITS (old_table)<br /><br /> All columns in 'old_table' will be inclueded in 'new_table'
plusthe column 'new_column'.  

pgsql-sql by date:

Previous
From: Ken Hill
Date:
Subject: Re: Non Matching Records in Two Tables
Next
From: Maciej Piekielniak
Date:
Subject: Re: create table and data types