Deferrable on foreign keys in exported schema

Peter Russell <[email protected]> Tue, 8 Mar 2011 10:58:44 +0000 (UTC)
Newsgroups gmane.comp.db.mdb-tools.devel
Message-ID <[email protected]>
Hi list,

I'm using mdb-tools to import an Access database into Postgres, one problem
though is that loading data into an exported schema is more difficult than it
could be.  It would help if the generated constraints were deferrable, so that
the data can be loaded in in any order.

Thanks

Peter Russell

diff --git a/src/libmdb/backend.c b/src/libmdb/backend.c
index 655303c..48830cd 100644
--- a/src/libmdb/backend.c
+++ b/src/libmdb/backend.c
@@ -643,7 +643,7 @@ mdb_get_relationships(MdbHandle *mdb, const gchar
*namespace, const char* tablen
                                " REFERENCES ", quoted_table_2, "(",
quoted_column_2, ")",
                                (grbit & 0x00000100) ? " ON UPDATE CASCADE" : "",
                                (grbit & 0x00001000) ? " ON DELETE CASCADE" : "",
-                               ";\n", NULL);
+                               " DEFERRABLE", ";\n", NULL);
 
                        break;
                }



------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d