pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Guy Fraser <guy@incentre.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: converting microsoft sql server 2000 sql-code for postgresql
Date: Tue, 28 Jan 2003 20:55:24 -0500
Message-ID: <16682.1043805324@sss.pgh.pa.us> (raw)
In-Reply-To: <3E36FCF0.5060305@incentre.net>
References: <000901c2c6b5$2deef350$240aa8c0@L1PC01>
	<200301281728.16020.mallah@trade-india.com>
	<3E36FCF0.5060305@incentre.net>

Guy Fraser <guy@incentre.net> 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



view thread (9+ messages)  latest in thread

Message-ID: <16682.1043805324@sss.pgh.pa.us>
Permalink:  ../16682.1043805324@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16682.1043805324@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, guy@incentre.net
  Subject: Re: converting microsoft sql server 2000 sql-code for postgresql
  In-Reply-To: <16682.1043805324@sss.pgh.pa.us>

* 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