"typedef" in Pstgresql? - Mailing list pgsql-sql

From Zalman Stern
Subject "typedef" in Pstgresql?
Date
Msg-id 199903080021.QAA08433@netcom15.netcom.com
Whole thread Raw
List 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 by date:

Previous
From: Zalman Stern
Date:
Subject: "typedef" in Pstgresql?
Next
From: "Weon-sun Lee"
Date:
Subject: Help: insert inheritance class