Problem using IP functions
От
Marc Lamothe
Тема
Problem using IP functions
Дата
Msg-id
9dhig8$2nfd$1@news.tht.net
Список
Дерево обсуждения
Problem using IP functions "Marc Lamothe" <mlamothe@openface.ca>
Re: Problem using IP functions Tom Lane <tgl@sss.pgh.pa.us>
how to remove ? "Subhramanya Shiva" <shiva@archeanit.com>
Re: how to remove ? Per-Olof Pettersson <pgsql@peope.net>
Hi,
I'm having trouble using the host() and netmask() functions within a select
query. For some reason, the following query returns 1 row:
ipdb=> select id, subnet_number from subnet where subnet_number =
'216.46.13.0';id | subnet_number
----+---------------96 | 216.46.13.0
(1 row)
Yet, if I replace the ip string literal with host('216.46.13.0/24'), I get
no results. ie:
ipdb=> select id, subnet_number from subnet where subnet_number =
host('216.46.13.0/24');
id | subnet_number
----+---------------
(0 rows)
Even though host('216.46.13.0/24') evaluates to 216.46.13.0
ipdb=> select host('216.46.13.0/24'); host
-------------216.46.13.0
(1 row)
The subnet_number column is a varchar(16) which I assume you can compare
with a text data type, which is what host() returns. Just to be sure, I
tried casting everything to type text, but that didn't do the trick.
ipdb=> select texteq(host('216.46.13.0/24')::text, '216.46.13.0'::text);texteq
--------f
(1 row)
Any insight would be greatly appreciated.
Marc
В списке pgsql-sql по дате отправления
От: Tom Lane
Дата: