Re: Oracle to Postgres : create type as object in Postgres

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ben Ali Rachid <souliman239(at)yahoo(dot)fr>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Oracle to Postgres : create type as object in Postgres
Date: 2009-05-24 16:42:18
Message-ID: 21793.1243183338@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ben Ali Rachid <souliman239(at)yahoo(dot)fr> writes:
> I've a Oracle type that I must translate to Postgres. This Oracle type is like below :

> CREATE OR REPLACE
> type D_Temp_Element as object
> (
> MEMBER FUNCTION to_string return Varchar2,
> MEMBER FUNCTION duration return D_Interval,
> ...
> ) ;

> How can I do that in Postgres ? Is there something that be equivalent ?

No, we don't have any concept of member functions. Just create the
composite type (I'm assuming it needs to be composite) and then create
functions that take it as parameter.

Note that because PG allows function overloading, there's no conflict
between, say, to_string(D_Temp_Element) and to_string(Some_Other_Type).
If you were only using member functions to prevent that kind of
conflict, I don't think you need to worry too much.

regards, tom lane

PS: this is not an appropriate question for -hackers. Please direct
simple usage questions to -general in future.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-05-24 18:48:19 Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?
Previous Message Kenneth Marshall 2009-05-24 16:02:22 Re: [PATCH] cleanup hashindex for pg_migrator hashindex compat mode (for 8.4)