Chris Jones <[EMAIL PROTECTED]> writes: > Derrell.Lipman wrote: >> >> Chris Jones <[EMAIL PROTECTED]> writes: >> >> I don't think that your original solution solves that problem either. You >> first posted this schema: >> >>> My schema looks as follows: >>> >>> CREATE TABLE rawfen ( fen VARCHAR(80) ); >>> CREATE INDEX rawfen_idx_fen ON rawfen(fen); >> >> but you didn't indicate that rawfen_idx_fen is a UNIQUE INDEX so it won't >> complain if there are duplicate strings. To accomplish this (but not >> solving >> your timing issue), you need this: >> >> CREATE TABLE rawfen ( fen VARCHAR(80) ); >> CREATE UNIQUE INDEX rawfen_idx_fen ON rawfen(fen); >> > > I probably should have made this more explicit, but in sqlite, every row has > a unique identifier named rowid, which exists even if it isn't explicity > declared in the schema, and I was depending on that. If you declare a > PRIMARY KEY, then this replaces rowid. > > Of course, it's probably better practice to explicitly declare the primary > key, but anyway, that's where I was going with it.
Those are two separate issues. Your declared problem was: > I don't think that solves my problem. Sure, it guarantees that the IDs are > unique, but not the strings. So to guarantee that the *strings* are unique, you need a UNIQUE index on the string field. The ROWID is the INTEGER PRIMARY KEY whether you specify a different name for it or not, but that will not guarantee that each of your *strings* is unique. Only a UNIQUE index on the string field will do that. As long as you understand this, no need to reply. Cheers, Derrell ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------