Re: [OT] Postgresql and PHP

From: rob stone <floriparob(at)gmail(dot)com>
To: Alessandro Baggi <alessandro(dot)baggi(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: [OT] Postgresql and PHP
Date: 2016-12-23 19:21:51
Message-ID: 1482520911.16508.9.camel@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,
On Fri, 2016-12-23 at 16:44 +0100, Alessandro Baggi wrote:
> Hi list,
> sorry for this OT.
>
> I have a table on postgresql like this:
>
> id serial not null,
> srcaddr varchar(16) not null
>
> I use this table to store ip address. I've used also inet type but 
> changed to see if this solves my problem.
>
>  From psql, I run:
>
> select count(*) from bs_ipsource where srcaddr = '192.168.1.1';
>
>

I store and retrieve IP Addresses as follows:-

id serial not null,
srcaddr inet not null

select count(*) from bs_ipsource where srcaddr = '192.168.1.1'::inet;

Cast the textual representation to inet.

Never had a problem.

HTH,
Rob

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2016-12-23 20:45:19 Re: Querying dead rows
Previous Message Adrian Klaver 2016-12-23 19:15:15 Re: [OT] Postgresql and PHP