2

I get this error with Monetdb when I try to load .tbl data in tables where there are primary key and foreign key, what's wrong? This is the command:

COPY INTO monet.CUSTOMER FROM '/home/nicola/Scrivania/ssb-dbgen-master/1gb/customer.tbl' USING DELIMITERS '|', '|\n' LOCKED;
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mark
  • 141
  • 1
  • 3
  • 15
  • hi could you post a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example?lq=1)? you haven't provided enough information for us to help you :) thanks – Anthony Damico Feb 28 '14 at 21:45

2 Answers2

1

It is always good to bulk-load into tables with (foreign-) keys disabled. You can add them after the load with the ALTER statement. see https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/LoadingBulkData

mkersten
  • 694
  • 3
  • 7
0

Another part of MonetDB's documentation says: "WARNING It is advised to add integrity constraints to the table after the file has been loaded. The ALTER statements perform bulk integrity checking and perform these checks often more efficiently." https://www.monetdb.org/Documentation/Manuals/SQLreference/CopyInto

Generally, for bulk loading into an existing table, is is advised to drop the indexes/foreign keys/other constraints, load the table, and then recreate the indexes/foreign keys/other constraints.

ady
  • 1,108
  • 13
  • 19