Oracle to Postgres : create type as object in Postgres

Поиск
Список
Период
Сортировка
Искать

Oracle to Postgres : create type as object in Postgres

От:
Ben Ali Rachid <souliman239@yahoo.fr>
Дата:
Hello,

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 ?
Thanks.

Rachid

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

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Ben Ali Rachid  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.

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

От:
Ben Ali Rachid <souliman239@yahoo.fr>
Дата:
>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.

OK thanks.


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

Sorry.

FAQ