Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Index to enforc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 3457 of 3559
Post > Topic >>

Index to enforce non-overlapping ranges?

by jlrobins@[EMAIL PROTECTED] (James Robinson) May 8, 2008 at 09:27 AM

Academic question here:

	Given a table with a pair of any sort of line-segment-esqe range  
delimiter columns, is it possible to build a unique index to enforce  
non-overlapping ranges? Such as:

	create table test
	(
		id int not null primary key,
		low_value int not null,
		high_value int not null
	);

	Can one build an index to enforce a rule such that no (low_value,  
high_value) range is identical or overlaps with another (low_value,  
high_value) range described by the table? And, more interestingly,  
what about for ranges of dates / timestamps as opposed to simple  
integers?

	I can see how a trigger on insert or update could enforce such a  
constraint [ probe the table for an existing overlapping row, and  
raise exception one exists ], but can such an activity be performed  
with fewer lines using some sort of r-tree index?

----
James Robinson
Socialserve.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 3 Posts in Topic:
Index to enforce non-overlapping ranges?
jlrobins@[EMAIL PROTECTED  2008-05-08 09:27:52 
Re: Index to enforce non-overlapping ranges?
tgl@[EMAIL PROTECTED] (T  2008-05-08 10:54:21 
Re: Index to enforce non-overlapping ranges?
Chris Browne <cbbrowne  2008-05-08 10:31:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 21:48:53 CDT 2008.