Updated privatemsg to Oct 1 release. Ran update.php . . . Results:

The following queries were executed
privatemsg module
Update #6

    * ALTER TABLE {users} ADD name_length INT NOT NULL DEFAULT 0
    * UPDATE {users} SET name_length = LENGTH(name)
    * Failed: CREATE TRIGGER user_name_length_insert BEFORE INSERT ON {users} FOR EACH ROW SET NEW.name_length = LENGTH(NEW.name)
    * Failed: CREATE TRIGGER user_name_length_update BEFORE UPDATE ON {users} FOR EACH ROW SET NEW.name_length = LENGTH(NEW.name)

Error shows as follows:



    * user warning: Access denied; you need the SUPER privilege for this operation query: CREATE TRIGGER user_name_length_insert BEFORE INSERT ON users FOR EACH ROW SET NEW.name_length = LENGTH(NEW.name) in /path/includes/database.mysql.inc on line 172.
    * user warning: Access denied; you need the SUPER privilege for this operation query: CREATE TRIGGER user_name_length_update BEFORE UPDATE ON users FOR EACH ROW SET NEW.name_length = LENGTH(NEW.name) in /path/includes/database.mysql.inc on line 172.

My db user has All permissions to its Drupal db. Why is a SUPER privilege needed?

Drupal 5.2
Apache 2.2.4
MySQL 5.0.44
PHP 5.2.4

Comments

samuelet’s picture

Same problem for me.
google says:
In version 5.0.x it is not a bug. You need SUPER priviledge just to CREATE TRIGGER.

Some infos here:
http://bugs.mysql.com/bug.php?id=18478

This could be a problem since many druapal installation don't use the SUPER user to connect to mysql.

Zen’s picture

Title: Failed: CREATE TRIGGER with Oct 1 release » privatemsg_update_6 incorporates MySQL-5 only features and alters a core table
Priority: Normal » Critical

As the topic change suggests, update_6 introduces some rather restrictive and questionable changes. Contrib modules should not alter core tables. And while even D6 supports MySQL 4.1 as a minimum, this module should not raise the minimum requirements to 5.

-K

LuRcH@www.daihatsu-drivers.co.uk’s picture

I have to agree, I am starting to become deeply concerned about the developments happening in this branch of privatemsg. First it requiring the subscriptions module. I can't see a real reason why it become compulsory as I didn't want to run the subscriptions module on my site. The only thing I can see is that both are now maintained by the same new person. Now its starting to require MySQL5. none of the hosting companies I use (4 in total) none of them have MySQL5 running. Makes one consider creating a new branch which is a bit more friendly to end users requirements. :)

abqaria’s picture

subscribed

Zen’s picture

@lurch: Please see (and if possible test the patch in) this issue which decouples the subscription module from the privatemsg module.

-K

salvis’s picture

I agree that the current behavior is not as it should be, and I think I've been able to convince chx to fix it.

For now you have two choices:

If you're using MySQL 5, you can manually install the triggers with SUPER privilege. Check for any records that have name_length=0 (and uid<>0) and fix them manually.

Otherwise, set the users.name_length column to all zeros...

update users set name_length = 0;

... and you'll get the old behavior.

IMO, the old behavior is preferable anyway...

LuRcH@www.daihatsu-drivers.co.uk’s picture

@ Zen: Thanks thats great! Have patched and uploaded now. 1st impressions look hopeful so far :)

Zen’s picture

@Lurch: please state that in the other issue, not here.

-K

mr.andrey’s picture

Does settings name_length have other implications? In which other places is it used?

When a new user registers, and their name_length gets set to more than 0, does this break anything for the privatemsg?

Thanks,
Andrey.

salvis’s picture

It's only used for sorting the names in the dynamic list.

If some name_length's are 0 and others not, then the sort order will be broken, that's all.

salvis’s picture

... However, there's another issue with that latest snapshot: update_6() and install() fail to add the variables column to the privatemsg table. So if you haven't updated yet, you might be better off to wait...

mr.andrey’s picture

Ah yes, I noticed that error and posted it here: http://drupal.org/node/182369

Is it now fixed, so I could upgrade to the latest CVS or should I wait for other fixes before doing that?

Thanks!
Andrey.

salvis’s picture

Privatemsg is unchanged since 10 days ago. chx is planning to clean it up this weekend.

manuj_78’s picture

I upgraded my module and it is coming up with the following error


    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER user_name_length_insert BEFORE INSERT ON users FOR EACH ROW SET NEW.name' at line 1 query: CREATE TRIGGER user_name_length_insert BEFORE INSERT ON users FOR EACH ROW SET NEW.name_length = LENGTH(NEW.name) in /home/website/public_html/scratch/includes/database.mysql.inc on line 172.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER user_name_length_update BEFORE UPDATE ON users FOR EACH ROW SET NEW.name' at line 1 query: CREATE TRIGGER user_name_length_update BEFORE UPDATE ON users FOR EACH ROW SET NEW.name_length = LENGTH(NEW.name) in /home/website/public_html/scratch/includes/database.mysql.inc on line 172.

Any help will be greatly appreciated.

salvis’s picture

Yes, the snapshot is still "Last updated: October 2, 2007"

We're still waiting — I'm sorry to raise hopes prematurely.

Zen’s picture

Assigned: Unassigned » Zen
Status: Active » Fixed

This has been fixed via a roll-back. This is a development branch. There will be no roll-back updates added to the module - the updates have just been removed.

However, the following queries will get your tables up-to-date. Run them one by one ...

Delete the name_length column:
ALTER TABLE users DROP name_length;

Delete the triggers if they have been added. These two queries will fail on systems that do not support Triggers.
DROP TRIGGER IF EXISTS user_name_length_insert;
DROP TRIGGER IF EXISTS user_name_length_update;

Reset the update level of the module:
UPDATE system SET schema_version = 4 WHERE name = 'privatemsg' AND type = 'module';

Run the updater now to get this fix.

The above queries have only been tested for syntax.

-K

Zen’s picture

Missing URL issue in my last post: "this fix".

Anonymous’s picture

Status: Fixed » Closed (fixed)

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