Opened 7 years ago

Closed 6 years ago

#1483940 closed Bugs (fixed)

MySQL 5 error: Field 'vcard' doesn't have a default value

Reported by: mwhitlock Owned by:
Priority: 5 Milestone: 0.1-rc1
Component: Database Version: 0.1-beta
Severity: major Keywords:
Cc:

Description

When MySQL is running in strict mode (which the MySQL installer recommends), attempting to add a contact in Roundcube 0.1-beta2 fails, and this message is appended to the error log:

[07-Aug-2006 07:43:23 -0500] DB Error: DB Error: unknown error Query: INSERT INTO contacts (user_id, changed, del, name, email) VALUES ('1', now(), 0, 'Matt Whitlock', 'mwhitlock@…') [nativecode=1364 Field 'vcard' doesn't have a default value] in C:\htdocs\default\roundcube\program\include\rcube_db.inc on line 479

The column contacts.vcard is declared as a TEXT NOT NULL, so it needs to be given a value in the INSERT query.

Here are three easy solutions:

  1. Change the type of the vcard column to TEXT NULL and allow it to take a NULL value by default.
  2. Give the vcard column an explicit value of (empty string) in the INSERT query.
  3. Change the type of the vcard column to VARCHAR(65535) NOT NULL DEFAULT . (Note that TEXT columns cannot have default values.)

Change History (4)

comment:1 Changed 7 years ago by mwhitlock

Doh! I didn't see the thing about this box using Wiki formatting.

The last paragraph is supposed to be:

Here are three easy solutions:

  1. Change the type of the vcard column to TEXT NULL and allow it to take a NULL value by default.
  2. Give the vcard column an explicit value of '' (empty string) in the INSERT query.
  3. Change the type of the vcard column to VARCHAR(65535) NOT NULL DEFAULT ''. (Note that TEXT columns cannot have default values.)

comment:2 Changed 7 years ago by mwhitlock

The same problem affects the signature field of the identities table. It prevents new identities from being created. Changing the column type to TEXT NULL made the problem disappear.

comment:3 Changed 6 years ago by jpingle

May be related to #1483978

comment:4 Changed 6 years ago by thomasb

  • Milestone set to 0.1-rc1
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in trunk ([3c3b3517])

Note: See TracTickets for help on using tickets.