Re: How to get Relation name from Oid ??
От | Tom Lane |
---|---|
Тема | Re: How to get Relation name from Oid ?? |
Дата | |
Msg-id | 534.1078878798@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: How to get Relation name from Oid ?? ("Tom Hebbron" <news_user@hebbron.com>) |
Список | pgsql-hackers |
"Tom Hebbron" <news_user@hebbron.com> 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
В списке pgsql-hackers по дате отправления: