Re: inet increment w/ int8

From: "Ilya A(dot) Kovalenko" <shadow(at)oganer(dot)net>
To: Greg Stark <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: inet increment w/ int8
Date: 2005-04-20 04:30:08
Message-ID: 119150172356.20050420123008@oganer.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-04-20 06:20:11 Foreign keys on array elements
Previous Message Ilya A. Kovalenko 2005-04-20 03:53:25 Re: inet increment w/ int8