Changeset: 23c11a918e28 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/23c11a918e28
Modified Files:
        clients/mapiclient/dump.c
Branch: default
Log Message:
Dump UNIQUE NULLS NOT DISTINCT constraints.


diffs (38 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1131,14 +1131,15 @@ dump_column_definition(Mapi mid, stream 
                         "SELECT kc.name, "             /* 0 */
                                "kc.nr, "                       /* 1 */
                                "k.name, "                      /* 2 */
-                               "kc.id "                        /* 3 */
+                               "kc.id, "                       /* 3 */
+                               "k.type "                       /* 4 */
                         "FROM sys.objects kc, "
                              "sys.keys k, "
                              "sys.schemas s, "
                              "sys._tables t "
                         "WHERE kc.id = k.id "
                           "AND k.table_id = t.id "
-                          "AND k.type = 1 "
+                          "AND k.type in (1, 3) "
                           "AND t.schema_id = s.id "
                           "AND s.name = '%s' "
                           "AND t.name = '%s' "
@@ -1150,6 +1151,7 @@ dump_column_definition(Mapi mid, stream 
                const char *c_column = mapi_fetch_field(hdl, 0);
                const char *kc_nr = mapi_fetch_field(hdl, 1);
                const char *k_name = mapi_fetch_field(hdl, 2);
+               const char *k_type = mapi_fetch_field(hdl, 4);
 
                if (mapi_error(mid))
                        goto bailout;
@@ -1161,7 +1163,7 @@ dump_column_definition(Mapi mid, stream 
                                mnstr_printf(sqlf, "CONSTRAINT ");
                                dquoted_print(sqlf, k_name, " ");
                        }
-                       mnstr_printf(sqlf, "UNIQUE (");
+                       mnstr_printf(sqlf, "UNIQUE%s (", strcmp(k_type, "1") == 
0 ? "" : " NULLS NOT DISTINCT");
                        cnt = 1;
                } else
                        mnstr_printf(sqlf, ", ");
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to