Achieving uniqueness at database level in progress v11.6

Posted by Vel murugan on 01-Aug-2016 01:52

the below query works fine to fetch tha field details.

SELECT "_Field-Name", "_Data-type" FROM PUB."_Field" WHERE "_file-recid" = ( SELEC ROWID FROM PUB."_file" WHERE "_file-name" = 'Customer')";

in Progress v11.6,Since ROWID is not unique, in order to achieve uniqueness, i have changed the above query and replaced ROWID to PRO_PARTN_ROWID.

SELECT "_Field-Name", "_Data-type" FROM PUB."_Field" WHERE "_file-recid" = ( SELECT PRO_PARTN_ROWID FROM PUB."_file" WHERE "_file-name" = 'Customer')";

i am getting inconsistent types error. what am I missing here?

All Replies

Posted by George Potemkin on 01-Aug-2016 02:01

_file-recid values are the recid's from "Schema Area" that is type 1 and it can't be used for partitioning.

Posted by Vel murugan on 01-Aug-2016 06:42

Thanks [mention:ae2ea2f6412743fc8be36c522f414ef0:e9ed411860ed4f2ba0265705b8793d05]

Posted by gus bjorklund on 01-Aug-2016 09:04

use a sequence.

but: how much uniqueness do you need? what problem are you solving?

Posted by Vel murugan on 01-Aug-2016 10:41

the database is partitioned. the table values will be stored in diff partitions. progress v11.6. I will be updating other columns of the table based on a unique id available in database(ROWID or PRO_PARTN_ROWID or some other unique id). so I need a unique identifier. For a table the ID should be unique.

Posted by gus bjorklund on 01-Aug-2016 11:18

can you give an example of how you would do an update? how do you find the record in the first place so you can get its rowid (or other identifier, such as sequence number)?

what kinds of indexes will the tables have? why can’t you use one of those?

Posted by ChUIMonster on 01-Aug-2016 11:34

As Gus asked -- what problem are you solving?  You have asked a series of questions that all seem to revolve around some not quite clear requirement.

I can't quite figure out what you are trying to do but it seems like you are "over thinking" your approach.

Posted by ChUIMonster on 02-Aug-2016 10:58

While I'm at it...

Even if you are using the partition aware flavor, ROWIDs are a very poor choice for a unique identifier for quite a few reasons.

Among the many other reasons that this is a bad idea -- over time records almost certainly get deleted from the DB.  Those ROWIDs will be reused.  Even if that never happens someone may eventually come along and dump & re-load your database.  Or the table might be moved from one area to another.  Or a new partition might be created.  The ROWIDs can change when those sorts of things happen and the value that you have stored will no longer match.  (BTW -- how are you planning to store the ROWID?  As a string?  ROWID isn't a valid datatype for a db field...)

As another aside -- if you're thinking that the ROWID will give you a magical sequencing of the order in which records were created that would also be wrong.  

This thread is closed