From: Marc Lamothe <mlamothe@openface.ca>
To: pgsql-sql@postgresql.org
Subject: Problem using IP functions
Date: Fri, 11 May 2001 16:33:08 -0400
Message-ID: <9dhig8$2nfd$1@news.tht.net> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: mlamothe@openface.ca
Subject: Re: Problem using IP functions
In-Reply-To: <9dhig8$2nfd$1@news.tht.net>
References: <9dhig8$2nfd$1@news.tht.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox