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

From Maciej Piekielniak
Subject Re: create table and data types
Date
Msg-id 1621743066.20060214230317@isb.com.pl
Whole thread Raw
In response to Re: create table and data types  (Ken Hill <ken@scottshill.com>)
Responses Re: create table and data types
List pgsql-sql
Hello Ken,

Tuesday, February 14, 2006, 10:30:34 PM, you wrote:
KH> 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
>> ); 
>> 

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

KH> CREATE TABLE new_table (new_column)
KH>      INHERITS (old_table)

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

yes, but i don't need all colums, i need only the same data type for only
some fields.

for example
create table new table
(name other_table.name%TYPE,mynewfield VARCHAR(100),mynewfield2 VARCHAR(100)
);

-- 
Best regards,Maciej



pgsql-sql by date:

Previous
From: Ken Hill
Date:
Subject: Re: create table and data types
Next
From: Tom Lane
Date:
Subject: Re: create table and data types