I'm not a database programmer, but this task fell on me, and I would like to get to some help...
I need to insert records into a table, and I need to assign unique IDs. Once they reach a certain maximum limit ( let's say 1000 ), I would like to reset the ID to 0 and start over, writing over anything that existed with that ID before
I thought about using sequences, and in fact this does most of what I want -- if I insert a new row without the key, then the default value will be assigned. That's good, but that may fail if old data exists. In which case I need to either delete the old record then insert, or update it. Even if it's successful, I need to know what that ID was within the perl script, so I can notify the user that record ID.
Is there anyway to do this? I'm using PostgreSQL 7.1 for the backend
In reply to Cycle through primary key with DBI by lestrrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |