Re: Typecast a user-defined type?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Volpe <volpe(dot)mark(at)epamail(dot)epa(dot)gov>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Typecast a user-defined type?
Date: 2000-10-04 15:59:56
Message-ID: 3499.970675196@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Mark Volpe <volpe(dot)mark(at)epamail(dot)epa(dot)gov> writes:
> someone give me a hint, or point me to the appropriate material on how to get
> "value::text" to work with my new type?

Write a function "text(yourtype) RETURNS text", and the parser will use
it for type coercions from yourtype to text. In general any type
coercion can be provided this way --- a function of a single argument,
having the same name as its return type, represents a coercion path.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2000-10-04 20:07:54 Re: createuser
Previous Message Mark Volpe 2000-10-04 15:48:20 Typecast a user-defined type?