Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4D1BNA49894 for ; Sat, 12 May 2001 21:11:23 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4BKv0A36455 for ; Fri, 11 May 2001 16:57:00 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f4BKaQl89584 for pgsql-sql@postgresql.org; Fri, 11 May 2001 16:36:26 -0400 (EDT) (envelope-from news) From: "Marc Lamothe" X-Newsgroups: comp.databases.postgresql.sql Subject: Problem using IP functions Date: Fri, 11 May 2001 16:33:08 -0400 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 45 Message-ID: <9dhig8$2nfd$1@news.tht.net> X-Complaints-To: scrappy@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2462.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000 To: pgsql-sql@postgresql.org X-Archive-Number: 200105/116 X-Sequence-Number: 2932 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