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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Oracle to Postgres : create type as object in Postgres
Дата
Msg-id 21793.1243183338@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Oracle to Postgres : create type as object in Postgres  (Ben Ali Rachid <souliman239@yahoo.fr>)
Список 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 по дате отправления:

Предыдущее
От: Kenneth Marshall
Дата:
Сообщение: Re: [PATCH] cleanup hashindex for pg_migrator hashindex compat mode (for 8.4)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?