| От | Dominik Moritz |
|---|---|
| Тема | Re: check if type is valid pg type |
| Дата | |
| Msg-id | 667E7C54-F2BA-466A-86A2-128195026857@gmail.com обсуждение исходный текст |
| Ответ на | Re: check if type is valid pg type (Josh Kupershmidt <schmiddy@gmail.com>) |
| Ответы |
Re: check if type is valid pg type
|
| Список | pgsql-novice |
Hi Josh, That is exactly what I needed. Thank you very much. However, is there a way to do this without getting an exception if thetype does not exist? Cheers, Dominik On Oct 10, 2012, at 23:20 , Josh Kupershmidt <schmiddy@gmail.com> wrote: > On Mon, Oct 1, 2012 at 3:47 PM, Dominik Moritz <domoritz@gmail.com> wrote: >> I need to check, whether a type is a valid postgres type or not. My first take was to check in the pg_type table. However,pg_type does not list types such as integer (but it does list int4) or float (but it does indeed list float8). Whatis the best way to check whether a type is valid or not? > > You could cast the type name to regtype, e.g. > > SELECT 'integer'::regtype, 'float'::regtype; > > Josh
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера