Skip site navigation (1) Skip section navigation (2)

Re: converting microsoft sql server 2000 sql-code for postgresql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Guy Fraser <guy(at)incentre(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: converting microsoft sql server 2000 sql-code for postgresql
Date: 2003-01-29 01:55:24
Message-ID: 16682.1043805324@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
Guy Fraser <guy(at)incentre(dot)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

In response to

Responses

pgsql-sql by date

Next:From: Tom LaneDate: 2003-01-29 02:18:16
Subject: Re: Problem with query
Previous:From: Jean-Luc LachanceDate: 2003-01-29 01:50:33
Subject: Re: CSV import

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group