"Tom Hebbron" <[EMAIL PROTECTED]> writes: > If you need to use the path returned from the regclass cast as text, you > will need to create a cast from regclass to text - this can be achieved > using the following functions - making use of the cstring type that the > return/input functions for these types have in common. I'd not sure how safe > an approach this is - and would appreciate any comments.
This works, and is safe in versions where cstring is a full-fledged type (I forget whether that was in 7.3 or 7.4). But it might be notationally cleaner to use plpgsql. plpgsql's idea of type coercion is to do exactly this output-to-string-and-input-again trick, so the functionality would be the same, but you'd only need to write CREATE OR REPLACE FUNCTION utilities.text(regclass) RETURNS text STRICT STABLE AS 'begin; return $1; end' LANGUAGE plpgsql; I am not sure about speed considerations. Pre-7.4 the SQL function method would certainly be slower, but as of 7.4 you can probably inline the SQL function and it might come out ahead. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match