| От | Joe Conway |
|---|---|
| Тема | Re: Inability to cast regclass is too restrictive |
| Дата | |
| Msg-id | 41675769.6020600@joeconway.com обсуждение исходный текст |
| Ответ на | Inability to cast regclass is too restrictive (Oliver Elphick <olly@lfix.co.uk>) |
| Список | pgsql-hackers |
Oliver Elphick wrote: > I tried to use regclass() in a plpgsql function to derive a tablename > from its oid so as to build a command string, but I am unable to use the > value returned because it cannot be cast to anything. Therefore I will > have to use a complex query on the catalog to do the same work. > > This seems overly restrictive. Would there be a problem in allowing > regclass() to be cast to text? > I agree (I've been frustrated by this myself before), but for a workaround, see the following: create or replace function any2text(anyelement) returns text as' begin return $1; end ' language plpgsql; select any2text(1255::oid::regclass) || ' is the relname in text'; ?column? -------------------------------- pg_proc is the relname in text (1 row) HTH, Joe
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера