Index: trunk/psLib/src/db/psDB.c
===================================================================
--- trunk/psLib/src/db/psDB.c	(revision 17838)
+++ trunk/psLib/src/db/psDB.c	(revision 17841)
@@ -23,5 +23,5 @@
  * 4.1.2 or newer is required.
  *
- * $Id: psDB.c,v 1.154 2008-05-29 02:35:34 jhoblitt Exp $
+ * $Id: psDB.c,v 1.155 2008-05-29 02:43:04 jhoblitt Exp $
  */
 
@@ -1641,11 +1641,11 @@
     }
 
+
     // Reset iterator to head of list
     psListIteratorSet(cursor, 0);
-
-    // look for INDEX values
+    // look for UINDEXs before INDEXs
     while ((item = psListGetAndIncrement(cursor))) {
         // don't compile a regex unless we have too
-        if (psStrcasestr(item->comment, "INDEX") == NULL) {
+        if (psStrcasestr(item->comment, "UINDEX") == NULL) {
             continue;
         }
@@ -1655,5 +1655,5 @@
         int             errbuf_size = 1024;
         char            errbuf[errbuf_size];
-        char            *pattern = "INDEX[:space:]*[(]([^)]*)";
+        char            *pattern = "UINDEX[:space:]*[(]([^)]*)";
 
         int status = regcomp(&myregex, pattern, REG_EXTENDED|REG_ICASE);
@@ -1678,5 +1678,5 @@
         regfree(&myregex);
 
-        // sub string 1: index(.*)
+        // sub string 1: uindex(.*)
         size_t matchStart = (size_t)mymatch[1].rm_so;
         size_t matchEnd   = (size_t)mymatch[1].rm_eo;
@@ -1692,5 +1692,5 @@
         psString index = psStringNCopy(item->comment + matchStart, matchLength);
         psTrace("psLib.db", 10, "regex $1 matched: %s", index);
-        psStringAppend(&query, ", INDEX(%s)", index);
+        psStringAppend(&query, ", UNIQUE KEY(%s)", index);
         psFree(index);
     }
@@ -1698,8 +1698,8 @@
     // Reset iterator to head of list
     psListIteratorSet(cursor, 0);
-    // look for UNIQUE INDEXES
+    // look for INDEX values
     while ((item = psListGetAndIncrement(cursor))) {
         // don't compile a regex unless we have too
-        if (psStrcasestr(item->comment, "UINDEX") == NULL) {
+        if (psStrcasestr(item->comment, "INDEX") == NULL) {
             continue;
         }
@@ -1709,5 +1709,5 @@
         int             errbuf_size = 1024;
         char            errbuf[errbuf_size];
-        char            *pattern = "UINDEX[:space:]*[(]([^)]*)";
+        char            *pattern = "INDEX[:space:]*[(]([^)]*)";
 
         int status = regcomp(&myregex, pattern, REG_EXTENDED|REG_ICASE);
@@ -1732,5 +1732,5 @@
         regfree(&myregex);
 
-        // sub string 1: uindex(.*)
+        // sub string 1: index(.*)
         size_t matchStart = (size_t)mymatch[1].rm_so;
         size_t matchEnd   = (size_t)mymatch[1].rm_eo;
@@ -1746,5 +1746,5 @@
         psString index = psStringNCopy(item->comment + matchStart, matchLength);
         psTrace("psLib.db", 10, "regex $1 matched: %s", index);
-        psStringAppend(&query, ", UNIQUE KEY(%s)", index);
+        psStringAppend(&query, ", INDEX(%s)", index);
         psFree(index);
     }
