From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | "Ilya A(dot) Kovalenko" <shadow(at)oganer(dot)net> |
Cc: | Greg Stark <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: inet increment w/ int8 |
Date: | 2005-04-20 15:18:10 |
Message-ID: | 20050420151810.GA512@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Apr 20, 2005 at 12:30:08 +0800,
"Ilya A. Kovalenko" <shadow(at)oganer(dot)net> wrote:
> GS> I see a use case for of generating addresses based on a sequence or some
> GS> primary key from the database.
>
> GS> Something like
>
> GS> CREATE SEQUENCE hosts_ip_seq MAXVALUE 65536;
> GS> ALTER TABLE hosts ALTER ip SET DEFAULT '10.0.0.0/16'::inet + nextval(hosts_ip_seq')
>
> hmm, not quite good idea - SEQUENCEs, by design, does not rollback next
> value on transation rollback, so you'll have holes on address range when
> other values will break some constraints or concurrent sessions
> appears.
You are going to have to have some way of handling holes anyway. What
happens when an allocated IP address is returned? That is why I think
for most uses a table with a row for each possible allocation is the
way to go.
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2005-04-20 16:50:11 | Re: [GENERAL] Idea for the statistics collector |
Previous Message | Marc G. Fournier | 2005-04-20 15:10:41 | Re: HAVING <alias> ... |