Re: [SQL] exclusion constraint for ranges of IP

2011-08-23 Thread Herouth Maoz
On 23/08/2011, at 13:31, Jasen Betts wrote: > On 2011-08-23, Herouth Maoz wrote: > >>EXCLUDE USING GIST ( customer_id WITH =, is_default WITH AND ) > > >> Basically, each customer can have several rows in this table, but only = >> one per customer is allowed to have is_default =3D true.

Re: [SQL] exclusion constraint for ranges of IP

2011-08-23 Thread Jasen Betts
On 2011-08-23, Herouth Maoz wrote: > EXCLUDE USING GIST ( customer_id WITH =, is_default WITH AND ) > Basically, each customer can have several rows in this table, but only = > one per customer is allowed to have is_default =3D true. Is this exclude = > constraint correct? I don't really

Re: [SQL] exclusion constraint for ranges of IP

2011-08-23 Thread Samuel Gendler
On Tue, Aug 23, 2011 at 1:27 AM, Herouth Maoz wrote: > My thanks to everyone who replied. > > I have decided not to implement that constraint at this time. Using a > compound type will make the system more complicated and less readable, plus > requires installing the package which is beyond vanil

Re: [SQL] exclusion constraint for ranges of IP

2011-08-23 Thread Herouth Maoz
My thanks to everyone who replied. I have decided not to implement that constraint at this time. Using a compound type will make the system more complicated and less readable, plus requires installing the package which is beyond vanilla PostgreSQL. Now I have another exclusion constraint I'm th

Re: [SQL] exclusion constraint for ranges of IP

2011-08-22 Thread Harald Fuchs
In article <1343d11c-6f58-4653-8ea8-837c01e61...@unicell.co.il>, Herouth Maoz writes: > On 22/08/2011, at 01:19, Harald Fuchs wrote: >> In article , >> Herouth Maoz writes: >> >>> Hi, >>> I'm designing a new database. One of the table contains allowed IP ranges >>> for a customer (Fields: cus

Re: [SQL] exclusion constraint for ranges of IP

2011-08-22 Thread Misa Simic
Hi Herouth, I think you are right about exclusion... If you are getting 'string' I think then command would be: INSERT INTO customer_ip_range(cutomer_id, ip4r) VALUES('customeridstring', ip4r('iprangestring')) Kind Regards, Misa 2011/8/22 Herouth Maoz > > On 22/08/2011, at 01:19, Harald Fuc

Re: [SQL] exclusion constraint for ranges of IP

2011-08-22 Thread Jasen Betts
On 2011-08-21, Herouth Maoz wrote: > Hi, > > I'm designing a new database. One of the table contains allowed IP ranges for > a customer (Fields: customer_id, from_ip, to_ip) which is intended to check - > if an incoming connection's originating IP number falls within the range, it > is identif

Re: [SQL] exclusion constraint for ranges of IP

2011-08-22 Thread Simone Sanfratello
Hi, you can do the identification of customer by ip in many ways. IMHO, first of all, you have to put the allowed IPs into your table. The simpler way is to write all IPs allowed, of course. The simpler way to do range check is to have 2 columns in table, IP-range-starts and IP-range-ends, so the S

Re: [SQL] exclusion constraint for ranges of IP

2011-08-22 Thread Herouth Maoz
On 22/08/2011, at 01:19, Harald Fuchs wrote: > In article , > Herouth Maoz writes: > >> Hi, >> I'm designing a new database. One of the table contains allowed IP ranges >> for a customer (Fields: customer_id, from_ip, to_ip) which is intended to >> check - if an incoming connection's origina

Re: [SQL] exclusion constraint for ranges of IP

2011-08-21 Thread Harald Fuchs
In article , Herouth Maoz writes: > Hi, > I'm designing a new database. One of the table contains allowed IP ranges for > a customer (Fields: customer_id, from_ip, to_ip) which is intended to check - > if an incoming connection's originating IP number falls within the range, it > is identifie

[SQL] exclusion constraint for ranges of IP

2011-08-21 Thread Herouth Maoz
Hi, I'm designing a new database. One of the table contains allowed IP ranges for a customer (Fields: customer_id, from_ip, to_ip) which is intended to check - if an incoming connection's originating IP number falls within the range, it is identified as a particular customer. Naturally, I'd l