"typedef" in Pstgresql?

Поиск
Список
Период
Сортировка
От Zalman Stern
Тема "typedef" in Pstgresql?
Дата
Msg-id 199903080006.QAA06569@netcom15.netcom.com
обсуждение исходный текст
Список pgsql-sql
Hi,

I'm looking for a way to create a "typedef" from a name of my choosing to a
basic type in Postgres. I would like to be able to set it up so that
"boolean" means the same thing as "bool", "string" means the same thing as
"text", and "integer" means the same thing as "int4". (I have an app that
expects this to be true.)

It seems like this should be possible. One can easily add the types to the
pg_type table, but this doesn't help to get the pg_operator table setup
correctly and my attempts to do that break things very badly because all of
the sudden, all sorts of queries are ambiguous and require extra casts.

Is there a simple way to do this? Will just adding cast functions for the
newly declared types to the correct internal types solve the problem? Is
there a way to write a cast from "integer" to "int4" without doing an
extension module in C? The data representations are bytewise exactly the
same in each case of course. (If push comes to shove, I'll either write the
extension module or modify the client code to remap typenames...)

Thanks,
-Z-

В списке pgsql-sql по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] 6.4.x to 6.5
Следующее
От: Zalman Stern
Дата:
Сообщение: "typedef" in Pstgresql?