varchar/name casts - Mailing list pgsql-hackers

From Peter Eisentraut
Subject varchar/name casts
Date
Msg-id 200808151600.47471.peter_e@gmx.net
Whole thread Raw
Responses Re: varchar/name casts  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
With this query you can view all casts involving varchar:

SELECT castsource::regtype, casttarget::regtype, castfunc::regprocedure, 
castcontext FROM pg_cast WHERE 'varchar'::regtype IN (castsource, casttarget) 
ORDER BY 1, 2;

Note that varchar mostly "borrows" the cast functions from the text type.  The 
exception is that there is a separate set of SQL-level functions for casting 
between name and varchar and vice versa.  But these are actually matched to 
the same C-level functions as the casts between text and name (name_text() 
and text_name()).

Does anyone recall a reason for this special case or is it just another dark 
area in the casting maze?  If the latter, I would like to remove the extra 
functions and redefine the casts between varchar and name to use the 
SQL-level casting functions for the text type.


pgsql-hackers by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: proposal sql: labeled function params
Next
From: Peter Eisentraut
Date:
Subject: Re: proposal sql: labeled function params