X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D0CDE9DC8A3 for ; Tue, 14 Feb 2006 18:03:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75773-04 for ; Tue, 14 Feb 2006 18:03:24 -0400 (AST) X-Greylist: delayed 00:50:59.555263 by SQLgrey- Received: from isb.com.pl (isb.com.pl [212.160.150.140]) by postgresql.org (Postfix) with ESMTP id 99CAA9DC859 for ; Tue, 14 Feb 2006 18:03:20 -0400 (AST) Received: from 192.168.0.17 (sembrz [192.168.1.50]) by isb.com.pl (Postfix) with ESMTP id CEB9757842; Tue, 14 Feb 2006 22:59:48 +0100 (CET) Date: Tue, 14 Feb 2006 23:03:17 +0100 From: Maciej Piekielniak X-Mailer: The Bat! (v1.62r) Reply-To: Maciej Piekielniak X-Priority: 3 (Normal) Message-ID: <1621743066.20060214230317@isb.com.pl> To: Ken Hill Cc: pgsql-sql@postgresql.org Subject: Re: create table and data types In-Reply-To: <1139952634.3083.72.camel@localhost.localdomain> References: <1827225102.20060214221218@isb.com.pl> <1139952634.3083.72.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200602/158 X-Sequence-Number: 24168 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