On Fri, Mar 02, 2012 at 10:44:20AM +0100, Christoph P.U. Kukulies scratched on 
the wall:
> When defining a column TEXT PRIMARY KEY (is that possible on TEXT?),
> would this imply uniqueness?

  Kind of.  It implies uniqueness in the SQL sense, which does not
  include NULLs (remember, NULL != NULL).  The SQL term "PRIMARY KEY"
  should imply both "UNIQUE" and "NOT NULL", but there is a long
  standing issue in SQLite that allows NULLs in non-integer PRIMARY
  KEY columns.  This allows "duplicate" NULL entries in a PK column.

  Normally this isn't an issue, as you shouldn't have NULLs in a
  single-column PK anyways.
  
> Or would I have to write something like TEXT PRIMARY KEY UNIQUE ?

  No, but to be extra safe you should write "TEXT PRIMARY KEY NOT NULL."

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to