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

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




view thread (6+ messages)  latest in thread

Message-ID: <1621743066.20060214230317@isb.com.pl>
Permalink:  ../1621743066.20060214230317@isb.com.pl/
Also on:    postgresql.org/message-id/1621743066.20060214230317@isb.com.pl

 · 

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

* 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