Results in an error like:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'link' for key 'PRIMARY': INSERT INTO {l10n_update_project} (name, project_type, core, version, l10n_server, l10n_path, status) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array
(
[:db_insert_placeholder_0] => link
[:db_insert_placeholder_1] => module
[:db_insert_placeholder_2] => 7.x
[:db_insert_placeholder_3] => 7.x-1.0
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] => http://ftp.drupal.org/files/translations/7.x/link/link-7.x-1.0.%language.po
[:db_insert_placeholder_6] => 1
)
in drupal_write_record() (line 6975 of /var/www/stofa/includes/common.inc).
Drush command terminated abnormally due to an unrecoverable error. [error]

Comments

xen’s picture

StatusFileSize
new800 bytes

Apparently, clearing the module list cache fixes the issue. Makes sense if module_enable might be called multiple times in one session. Doesn't make sense that it doesn't fail with MySQL.

xen’s picture

Status: Active » Closed (fixed)

Never mind. Fixed in latest dev...

steinmb’s picture

Priority: Normal » Major
Status: Closed (fixed) » Active

Reopening this. Installing via a custom install profile still fails without #1, though installing from GUI in Drupal works.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 column name is not unique: INSERT INTO {l10n_update_project}     [error]
(name, project_type, core, version, l10n_server, l10n_path, status) VALUES (?, ?, ?, ?, ?, ?, ?); Array
(
    [0] => link
    [1] => module
    [2] => 7.x
    [3] => 7.x-1.0
    [4] => 
    [5] => http://ftp.drupal.org/files/translations/7.x/link/link-7.x-1.0.%language.po
    [6] => 1
)
 in drupal_write_record() (line 7013 of /drupal/includes/common.inc).
WD php: Warning: Cannot modify header information - headers already sent by (output started at /Applications/drush/includes/output.inc:37) [warning]
in drupal_send_headers() (line 1239 of /drupal/includes/bootstrap.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 column name is not unique: INSERT INTO {l10n_update_project} (name, project_type, core, version, l10n_server, l10n_path, status) VALUES (?, ?, ?, ?, ?, ?, ?); Array
(
    [0] => link
    [1] => module
    [2] => 7.x
    [3] => 7.x-1.0
    [4] => 
    [5] => http://ftp.drupal.org/files/translations/7.x/link/link-7.x-1.0.%language.po
    [6] => 1
)
 in drupal_write_record() (line 7013 of /drupal/includes/common.inc).
Drush command terminated abnormally due to an unrecoverable error.

Edit: Manually enable the module from drush also fail:

opi’s picture

I got the "Integrity constraint violation" error, running MySQL 5.1.61-0ubuntu0.10.10.1

Patch #1 doesn't apply within a drush.make file
( Unable to patch l10n_update with l10n_update-1490664-sqlite_error-1.patch. )

steinmb’s picture

@opi you are on the latest dev?

opi’s picture

Oups, I was with the 7.x-1.0-beta3.
Try my make file with the latest dev, works just fine ! Thank you

scuba_fly’s picture

Title: site-install fails when using SQLite » site-install fails when installing via a custom install profile
Version: 7.x-1.x-dev » 7.x-1.0-beta3

Changed to beta3 because this bug is fixed in the dev according the comments.

Got the same error while installing as custom profile on the latest 7.x-1.0-beta3 with mysql 5.1:

quickstart@qs10:~/websites/drupal7test$ drush site-install vacatures --account-name=admin --account-pass=admin --db-url=mysql://d7t:d7t@localhost/d7t
You are about to create a sites/default/files directory and create a sites/default/settings.php file and DROP all tables in your 'd7t' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ...                                                                                                                         [ok]
WD php: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'link' for key 'PRIMARY': INSERT INTO {l10n_update_project} (name, project_type, core, [error]
version, l10n_server, l10n_path, status) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6); Array
(
    [:db_insert_placeholder_0] => link
    [:db_insert_placeholder_1] => module
    [:db_insert_placeholder_2] => 7.x
    [:db_insert_placeholder_3] => 7.x-1.0
    [:db_insert_placeholder_4] => 
    [:db_insert_placeholder_5] => http://ftp.drupal.org/files/translations/7.x/link/link-7.x-1.0.%language.po
    [:db_insert_placeholder_6] => 1
)
 in drupal_write_record() (line 7036 of /home/quickstart/websites/drupal7test/includes/common.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'link' for key 'PRIMARY': INSERT INTO {l10n_update_project} (name, project_type, core, version, l10n_server, l10n_path, status) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array
(
    [:db_insert_placeholder_0] => link
    [:db_insert_placeholder_1] => module
    [:db_insert_placeholder_2] => 7.x
    [:db_insert_placeholder_3] => 7.x-1.0
    [:db_insert_placeholder_4] => 
    [:db_insert_placeholder_5] => http://ftp.drupal.org/files/translations/7.x/link/link-7.x-1.0.%language.po
    [:db_insert_placeholder_6] => 1
)
 in drupal_write_record() (line 7036 of /home/quickstart/websites/drupal7test/includes/common.inc).
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                 [error]
scuba_fly’s picture

trying to apply the patch

quickstart@qs10:~/websites/drupal7test/sites/all/modules/l10n_update$ wget http://drupal.org/files/l10n_update-1490664-sqlite_error-1.patch
--2012-10-26 17:04:41--  http://drupal.org/files/l10n_update-1490664-sqlite_error-1.patch
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 800 [text/plain]
Saving to: `l10n_update-1490664-sqlite_error-1.patch'

100%[=========================================>] 800         --.-K/s   in 0s      

2012-10-26 17:04:42 (34.1 MB/s) - `l10n_update-1490664-sqlite_error-1.patch' saved [800/800]
quickstart@qs10:~/websites/drupal7test/sites/all/modules/l10n_update$ patch < l10n_update-1490664-sqlite_error-1.patch 
patching file l10n_update.project.inc
Hunk #1 FAILED at 140.
1 out of 1 hunk FAILED -- saving rejects to file l10n_update.project.inc.rej

Am I doing something wrong? ( I don't have experience with patching ) Or is the patch bad?

sutharsan’s picture

Status: Active » Needs review

This patch should be applied to 7.x-1.x-dev, not to beta3. Development are always done on dev releases. The way you apply the patch is correct.

scuba_fly’s picture

Thanks for your replay, I didn't know that patches are used on the dev versions.

steinmb’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev
rodrigoaguilera’s picture

I can confirm that is working for me

czigor’s picture

Patch also works for me on an SQLite db with custom install profile.

steinmb’s picture

Status: Needs review » Reviewed & tested by the community

Let's get this simple one liner committed then.

sutharsan’s picture

Status: Reviewed & tested by the community » Needs work

I don't like this patch, it has all the elelements of a hack. What is the real problem we need to fix here? Agree it is a small change, but I'm not convinced it is a good one. Lets see is we can come up with a better solution. Back to 'needs work'.

marty2081’s picture

With 7.x-1.x-beta3 and a custom profile performing a site install through the Drupal GUI I get:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'token' for key 'PRIMARY'

When running the site install through Drush I get:

WD php: PDOException: SQLSTATE[23000]: Integrity constraint [error]
violation: 1062 Duplicate entry 'token' for key 'PRIMARY': INSERT
INTO {l10n_update_project} (name, project_type, core, version,
l10n_server, l10n_path, status) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2,
:db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6); Array
(
[:db_insert_placeholder_0] => token
[:db_insert_placeholder_1] => module
[:db_insert_placeholder_2] => 7.x
[:db_insert_placeholder_3] => 7.x-1.4
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] =>
http://ftp.drupal.org/files/translations/7.x/token/token-7.x-1.4.%langua...
[:db_insert_placeholder_6] => 1
)
in drupal_write_record() (line 7106 of
/home/martijn/www/dev.limebased.nl/includes/common.inc).
WD php: Warning: Cannot modify header information - headers already [warning]
sent by (output started at
/usr/local/share/drush/includes/output.inc:37) in
drupal_send_headers() (line 1212 of
/home/martijn/www/dev.limebased.nl/includes/bootstrap.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'token' for key 'PRIMARY': INSERT INTO {l10n_update_project} (name, project_type, core, version, l10n_server, l10n_path, status) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array
(
[:db_insert_placeholder_0] => token
[:db_insert_placeholder_1] => module
[:db_insert_placeholder_2] => 7.x
[:db_insert_placeholder_3] => 7.x-1.4
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] => http://ftp.drupal.org/files/translations/7.x/token/token-7.x-1.4.%langua...
[:db_insert_placeholder_6] => 1
)
in drupal_write_record() (line 7106 of /home/martijn/www/dev.limebased.nl/includes/common.inc).
Drush command terminated abnormally due to an unrecoverable error. [error]

When I use the latest dev version the install finishes without a problem, so I have the dev version in my install profile for quite a while now.

Although the fix in the current dev version might not be the perfect fix, I would like to see a new release (beta4?) so that I don't get the update warnings about l10n_client anymore.

mpv’s picture

Rerolled patch in #1 for beta3.

saltednut’s picture

Status: Needs work » Needs review
steinmb’s picture

Status: Needs review » Reviewed & tested by the community
saltednut’s picture

Status: Needs review » Needs work
Issue tags: -demo_framework

Unsure if this needs a reroll for dev's latest HEAD. #17 says it applies to beta3. Wouldn't it be best to check to ensure that l10n_update_get_projects(TRUE) completes before moving fwd? Patch coming...

saltednut’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +demo_framework
StatusFileSize
new874 bytes

Here we go...

Anonymous’s picture

Status: Needs work » Needs review
Issue tags: +demo_framework

subscribing

Désiré’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new870 bytes

I've tested the patch from #21, it works for me both for install with drush and from browser.

I've also rolled the patch back for the current stable beta3 version, since I don't want to use this module in dev state.

sutharsan’s picture

Status: Reviewed & tested by the community » Needs work

Patch does not apply.
I still don't like the solution (see #15) but as I don't have an alternative. Therefore I will accept any decent path that proves to fix the problem. But only if someone can supply me a custom install profile that fails without the patch.

sylvain lecoy’s picture

The module uses the update module assuming its loaded,

Error: Call to undefined function _update_process_fetch_task() in
/var/lib/jenkins/jobs/dlp-intranet-nightly/workspace/sites/all/modules/contrib/l10n_update/l10n_update.project.inc,
line 59

In install profiles this is not necessarily the case, l10n_update can be installed before the update module.

As l10n_update module use functions from update module blindly, you need to add the dependency in the info file to avoid this bugs.

dependencies[] = update

sutharsan’s picture

@Sylvian Lecoy, This is caused by #1671570: Fetch available module versions before Update module does.. We should fix it there.

balintbrews’s picture

Issue summary: View changes
StatusFileSize
new874 bytes

Rerolled patch from #23 against latest dev.

sweetchuck’s picture

This bug is only reproducible with this revision:
61b3217 - (tag: 7.x-1.0-beta3)

The next commit (9fb0c2c - #1373758: PDOException since upgrading to 7.x-5.0) is solve the problem.
I also try to reproduce the bug with all the rest of the revisions in the 7.x-1.x branch, but the problem is gone.

So I suggest create a new release because the second birthday of the 7.x-1.0-beta3 is around the corner.

sutharsan’s picture

Status: Needs work » Fixed

A new release will be there shortly.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.