Ticket #1485070 (closed Bugs: worksforme)

Opened 3 months ago

Last modified 3 months ago

SQL Strict Mode Identities issue

Reported by: bpat1434 Owned by:
Priority: 5 Milestone: 0.2-alpha
Component: Client Scripts Version: 0.1.1
Severity: major Keywords: SQL Strict identities identity
Cc:

Description

If your SQL server has "Strict Mode" enabled, then identities are not auto-created for them because the column definitions declare "not null" in the identities table. There is an easy solution (well, 2 options really):

(1) Make the table columns "NULL" (2) Edit the identity creation SQL to be: {{{ $DB->query(

"INSERT INTO ".get_table_name('identities')."

(identity_id, user_id, del, standard, name, email, organizatoin, reply-to, bcc, signature, html_signature)

VALUES (NULL, ?, 0, 1, ?, ?, , , , , )",

$user_id, strip_newlines($user_name), preg_replace('/@/', $user . '@', $sql_arr[0]));}}}

Either way will work. The code modification works on MySQL 5 using "SET sql_mode='TRADITIONAL'" as the strict mode enabler.

Change History

Changed 3 months ago by alec

  • status changed from new to closed
  • resolution set to fixed

Fixed by DDL changes in r1406.

Changed 3 months ago by nereusz

  • status changed from closed to reopened
  • resolution deleted

What about PostreSQL? Definitions for PgSQL are similar (they're not corrected yet). I have similar problem but with PgSQL.

Changed 3 months ago by alec

  • status changed from reopened to closed
  • resolution set to worksforme

Exactly what problem. Identities auto-creating works for me on postgres.

Changed 3 months ago by nereusz

I don't know exactly :/ Problem is that sometimes (for only small part of users that are created) webmail creates user and don't create default identity. There is no row in DB. I checked logs and there's nothing. I had some problems during migrating from 0.0.x to 0.1.0 and then 0.1.1 with database so maybe there is problem... I'll try using new DB and I will post my notices.

Changed 3 months ago by alec

Please try current svn version or use DB driver instead of MDB2, there was a bug in postgresql MDB2 driver, I think it could be that. Reopen if you'll get more info.

Changed 3 months ago by nereusz

I'm using DB instead od MDB2. It seems not geting new id in table user during creating new user in method create() in /program/include/*_user.php. There's no virtuser and it don't throwing error 500 :/ What is strange, it happens very rarely... I've made a "patch" in query() method (the same file) that it creates an default identity if there's no identity for user. So you just have to login again to create it. It's just a patch, not right solution :/

Note: See TracTickets for help on using tickets.