Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 63679478A7B for ; Tue, 28 Jan 2003 22:18:14 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 485EC47998B for ; Tue, 28 Jan 2003 20:55:23 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h0T1tO5u016683; Tue, 28 Jan 2003 20:55:24 -0500 (EST) To: Guy Fraser Cc: pgsql-sql@postgresql.org Subject: Re: converting microsoft sql server 2000 sql-code for postgresql In-reply-to: <3E36FCF0.5060305@incentre.net> References: <000901c2c6b5$2deef350$240aa8c0@L1PC01> <200301281728.16020.mallah@trade-india.com> <3E36FCF0.5060305@incentre.net> Comments: In-reply-to Guy Fraser message dated "Tue, 28 Jan 2003 14:58:08 -0700" Date: Tue, 28 Jan 2003 20:55:24 -0500 Message-ID: <16682.1043805324@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/450 X-Sequence-Number: 11315 Guy Fraser writes: > If you go through the documentation you can also find out how to CREATE your > own data TYPE to allow more direct use of non-PostgreSQL data types. Here is > an example that will allow input of any "datetime" data into PostgreSQL : > CREATE TYPE datetime AS (datetime timestamptz); I think what you probably really want is CREATE DOMAIN datetime AS timestamptz; or more SQL-spec-compliantly CREATE DOMAIN datetime AS timestamp with time zone; which essentially makes datetime a direct alias for timestamptz. The CREATE TYPE approach makes a rowtype containing one timestamptz column, which isn't really going to act the way you want --- for one thing, none of the predefined functions and operators for type timestamptz will accept it. With the DOMAIN approach, they will. regards, tom lane