Re: Oracle to Postgres : create type as object in Postgres - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Oracle to Postgres : create type as object in Postgres
Date
Msg-id 21793.1243183338@sss.pgh.pa.us
Whole thread Raw
In response to Oracle to Postgres : create type as object in Postgres  (Ben Ali Rachid <souliman239@yahoo.fr>)
List pgsql-hackers
Ben Ali Rachid <souliman239@yahoo.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.


pgsql-hackers by date:

Previous
From: Kenneth Marshall
Date:
Subject: Re: [PATCH] cleanup hashindex for pg_migrator hashindex compat mode (for 8.4)
Next
From: Tom Lane
Date:
Subject: Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?