Re: CREATE TYPE example needed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jim(at)contactbda(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE TYPE example needed
Date: 2003-01-15 20:26:48
Message-ID: 20528.1042662408@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jim Buttafuoco" <jim(at)spectrumtelecorp(dot)com> writes:
> I am looking for a way to create a VARCHAR2 (oracle) type so I can use the same SQL to create my tables in either Oracle
> or Postgresql. Does anyone have a working example?

In 7.3, it's easy to use a "domain" as a type alias.

CREATE DOMAIN varchar2 AS varchar;

This has the advantage that all the operations on varchar will work for
varchar2. If you make a real type, you need to provide all those
operations.

Note however that this doesn't give you any special syntax for varchar2.
If you're expecting to be able to write "varchar2(N)" you're still out
of luck...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Garo Hussenjian 2003-01-15 20:37:48 Re: postgres on a PDA
Previous Message Neil Conway 2003-01-15 20:19:36 Re: How to ALTER COLUMN to set a constraint of not null?