
Re: Q re ID field in database
hwitten wrote:Is the ID field unique for each table?
I.e. can I use the ID to delete with and therefor not have to match on several fields?
OK, so after a quick word with Matt (I'm sorely lacking much understanding of the SQL logging stuff), I believe the answer is yes, the ID field is unique for each table, but not across tables. I don't believe that you can use this field to match much of anything since it seems to be auto generated for each new row. The tables are created with the following SQL:
- Code: Select all
CREATE TABLE device_history_basic (
id #AUTO_INCR_KEY,
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
dev_name VARCHAR(255) NOT NULL,
dev_state BOOL,
dev_value SMALLINT
);
hwitten wrote:And an aside question, is there a postgreSQL equivalent for MySQL's Auto Increment that has eluded me thus far? Trying to go all postgreSQL for my Alert Prog.
And, happily, I believe the answer to this question is also in the code above - again, I don't know for sure, but it sure seems like it.
