Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by hub.org (8.10.1/8.10.1) with ESMTP id e94FxvG23913 for ; Wed, 4 Oct 2000 11:59:57 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.0/8.11.0) with ESMTP id e94FxuB03502; Wed, 4 Oct 2000 11:59:56 -0400 (EDT) To: Mark Volpe cc: pgsql-sql@postgresql.org Subject: Re: Typecast a user-defined type? In-reply-to: <39DB5144.CB58A440@epamail.epa.gov> References: <39DB5144.CB58A440@epamail.epa.gov> Comments: In-reply-to Mark Volpe message dated "Wed, 04 Oct 2000 11:48:20 -0400" Date: Wed, 04 Oct 2000 11:59:56 -0400 Message-ID: <3499.970675196@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200010/57 Mark Volpe 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