Running drush mi BeerUser reports:
Imported 0 (3 failed) in 0.4 sec (484/min) - done with 'BeerUser'
Looking at the messages, I see three very similar messages. Here's one:
Incorrect integer value: '' for column 'uid' at row 1 query: INSERT INTO users (name, status, created, mail, pass, uid, access) VALUES ('alice', 1, 1269970265, 'alice@example.com', '7c90f2dc82aa5dd4501132f6d074a53a', '', 1287009962) File /.../drupal/includes/database.mysqli.inc, line 128
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | uid-error-940984-16.patch | 1020 bytes | mikeryan |
| #15 | migrate.940984-15.patch | 505 bytes | adamdicarlo |
| #7 | uid_null.patch | 754 bytes | moshe weitzman |
| #6 | uid_null.patch | 754 bytes | moshe weitzman |
| #3 | migrate.940984-3.patch | 597 bytes | adamdicarlo |
Comments
Comment #1
adamdicarlo commentedI wasn't able to track down the cause of the problem today, but I'll investigate more tomorrow. Any ideas?
Comment #2
adamdicarlo commentedThe WineUser migration gives the same error, with each item failing. I'm on dbtng-6.x-1.0-alpha7. I tried alpha6 (no go, it crashes), checking out DRUPAL-6--1 dbtng, same result. I'll assume for now dbtng isn't the problem and I'll step through the migration code.
Comment #3
adamdicarlo commentedSeems to be because of what might be considered a bug in user_save(): if isset($array['uid']), then core will add uid to the query as a string (thus '%s' with NULL becomes ''). Ugh. I don't see an issue filed in core for this, though. It's bitten me before, actually, and I thought of it as simply a quirk.
Here's a patch for migrate that mitigates the problem.
Comment #4
adamdicarlo commentedComment #5
moshe weitzman commentedIt is possible that this fix is good for d6 but gives a notice for d7 (if the code comment can be believed)
Comment #6
moshe weitzman commentedI was seeing a similar (but not same) problem in my user migration and this patch fixes it. Actually, a reverse apply of your patch fixes it. I am guessing that you just reversed your files when generating the patch. Here is new patch. I will commit this when my tree is more up to date.
Comment #7
moshe weitzman commentedI was seeing a similar (but not same) problem in my user migration and this patch fixes it. Actually, a reverse apply of your patch fixes it. I am guessing that you just reversed your files when generating the patch. Here is new patch. I will commit this when my tree is more up to date.
Comment #8
adamdicarlo commentedMy patch is fine (it is as intended; I've used it with drush make already) -- check out the logic in Drupal 6's user_save() to see why $account['uid'] being set (even set to NULL) causes user_save() to generate a broken query....
Comment #9
mikeryanI cannot reproduce this with the latest D6 core, or with what I had before doing a cvs update (months old). What version of D6 are you using? Do you still get this problem with the latest? Also, what version of MySQL are you using?
Thanks.
Comment #10
adamdicarlo commentedOK. I just tried
mysql> INSERT INTO users (uid, name, mail) VALUES ('', 'foo', 'bar');in three different environments.Apparently, inserting '' for uid works only in some MySQL versions. I'm using MariaDB on my development machine, but I'm not sure if the problem is Maria, or if it's the version of MySQL this Maria is based on. Perhaps a configuration setting that makes warning 1366 an error.
My development machine:
Two other environments both succeed with a warning:
So I think the question is: Should trying to insert '' for uid be considered a bug in migrate?
Comment #11
chrisnovak commentedI just created my first import using 6.x-2.0-beta1 of users from mediawiki into drupal by following the BeerUser example, and got this error.
I used the migrate.940984-3.patch adamdicarlo posted, and now all of my data is importing.
My development machine:
I ran
INSERT INTO users (uid, name, mail) VALUES ('', 'foo', 'bar')and got the following error:Comment #12
mikeryanOK, simpletests (and manual test) pass with this patch, committed. Thanks!
Comment #14
adamdicarlo commentedThe problem is back in 6.x-2.0-rc2 due to this new code:
I think that D6's user_save() isn't going to let that notice be avoided *and* generate the proper query. (Maybe there is a way, I don't know, but for now I have to patch migrate.)
I've rerolled and attached a new patch.
Comment #15
adamdicarlo commentedWhoops -- I guess hitting "Preview" when attaching a file was a bad idea. Here's the patch.
Comment #16
mikeryanOK, I think I've got an answer that addresses the notices as well as your problem, please try the attached patch.
Comment #17
mikeryanI went ahead and committed, I want to get a new release out today. Please try rc3 when it's available and reopen this issue if you still have trouble.
Thanks.