| От | Alvaro Herrera |
|---|---|
| Тема | Re: Is there any function to test for numeric ips? |
| Дата | |
| Msg-id | 20091211162847.GD30833@alvh.no-ip.org обсуждение исходный текст |
| Ответ на | Is there any function to test for numeric ips? ("Oliveiros C," <oliveiros.cristina@marktest.pt>) |
| Список | pgsql-sql |
Oliveiros C, wrote: > I've realized that, for ex, inet 'x.x.x.x' will fail if the input is not a numeric IP, > is there any simple and direct way to somewhat trap that error and convert it to a false value that can be used > in a WHERE clause? Yes, you can create a plpgsql function with an exception block; return false inside the exception, true otherwise. It looks something like begin perform $1::inet; return true; exception when invalid_something then return false end; I don't remember the exact syntax and the exception name but that should get you started. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера