CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • DB error when logging is enabled
Pages: [1]

Author Topic: DB error when logging is enabled  (Read 667 times)

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
DB error when logging is enabled
January 29, 2014, 11:12:42 am
I get the DB error when i enable logging at http://example.com/civicrm/admin/setting/misc?reset=1
mysql  Ver 14.14 Distrib 5.1.66, CiviCRM 4.4.3

Please see attached file for error details,

Has anyone encountered the same issue?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB error when logging is enabled
January 30, 2014, 05:02:55 am
I see this in the CREATE TABLE query:

Code: [Select]
  `master_id` varchar(255) DEFAULT NULL
            log_date    TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

which is invalid--it's missing a comma at the end of the first line. Looks like a bug in CiviCRM to me.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB error when logging is enabled
January 30, 2014, 10:12:04 am

i ran the same test on my local server and could not reproduce the error. i also checked the mysql logs for create table and master_id and saw that it had the proper syntax etc

can u check and see if your tables are MyISAM. seems like there are no constraints etc at the end, and hence the comma is missing from the master_id defn (just a random guess here)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: DB error when logging is enabled
January 31, 2014, 01:34:44 am
Hi Lobo,
thank you for willing to help, all my tables are InnoDB, all with constraint types (foreign key or primary key or unique)

Is there anyway to fix this??

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DB error when logging is enabled
January 31, 2014, 03:33:46 am
What is your MySQL version?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: DB error when logging is enabled
January 31, 2014, 03:56:35 am
I am having the same problem on two different versions of mysql:
mysql  Ver 14.14 Distrib 5.5.35, for debian-linux-gnu
mysql  Ver 14.14 Distrib 5.1.69, for debian-linux-gnu

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB error when logging is enabled
January 31, 2014, 08:03:26 am

if u have the php skills, u can debug this here:

CRM/Logging/Schema.php, function createLogTableFor

please report back with your findings.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: DB error when logging is enabled
January 31, 2014, 12:55:35 pm
Hi Lobo, hard coding on my local server  to this file CRM/Logging/Schema.php fixed the problem (see attached file). After the tables are created i deleted the single line code. Don't know if it is a good idea to do this on production but logging now works fine on my local installation.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB error when logging is enabled
January 31, 2014, 01:38:27 pm

that line is not present in our github repo for v4.4.3

https://github.com/civicrm/civicrm-core/blob/4.4.3/CRM/Logging/Schema.php#L477

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: DB error when logging is enabled
February 01, 2014, 12:56:06 am
I added this: $query = str_replace(', log_date', 'log_date', $query);  to fix the DB error which i deleted after the  log tables were created. I also noticed that even after deleting the line of code above , disabling and re-enabling logging at http://example.com/civicrm/admin/setting/misc?reset=1 doesn't reproduce the DB error again
« Last Edit: February 01, 2014, 01:23:33 am by kennedy »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • DB error when logging is enabled

This forum was archived on 2017-11-26.