Unanswered: find Minimum in range thats not in Table?
any help appreciated on this problem:
I've got a Table with a comparable Datatype (inet on postgres).
The values in the table have a minimum and a maximum value.
Now, I've got to find the smallest value betweeen min. and max. that is NOT in the table.
Entries: 10, 11, 12, 14, 18
needed value: 13 (larger than Min., smallest value not in Table)
I dont have pure Numbers to deal with, so
I dont want to create an auxiliary table with all the possible values and do a SELECT ... WHERE NOT IN ... statement.
Sorry, but my browser says 'SQL and PL/SQL' Forum; I'd say this is a SQL problem - not a postgres.
'inet' is an ip(v4)-address - this datatype is comparable but not incrementable.
I don't think it's necessary to create a table with some hundred continuous values that can be expressed by two borders; perhaps there is no other solution than an auxiliary table but that would be a pity.
meanwhile, i had a look at the postgresql docs, and found this page, which (a) freaks me out, but (b) offers encouragement that there might be custom functions available in postgresql for working with that datatype