I'm developing a system using mssql and based it off of the pgsql in the acl.install module. It sets a primary key on acl_user.acl_id that I don't think should be done. Perhaps the primary key should be the combination of both of them? This doesn't look like an issue for mysql or mysqli.

Comments

fago’s picture

Title: Primary Key on {acl_user} may be mistake on pgsql » fix acl db scheme (primary keys, utf8)
Status: Active » Needs review
StatusFileSize
new4.79 KB

yep, you are right.

I had a look at the db scheme. The mysql scheme doesn't even include primary keys. Furthermore the db scheme doesn't use utf8 for mysql > 4.1.
So I've gone over this issues and created a patch. It also adds an uninstallation routine.

I've tested the mysql upgrade path, but not the postgre sql, because I have no postgre sql test environment. It would be nice if someone could test it.

merlinofchaos, are the scheme changes ok for you?

salvis’s picture

StatusFileSize
new4.95 KB

Hi fago

Thanks for looking into this. Merlinofchaos has just turned ACL and Forum Access over to me.

About the patch:

  • I don't think you're allowed to specify a name for the primary key.
  • Wouldn't acl_node_grants() benefit from retaining the uid key on the acl_user table?
    The CREATE INDEX seems to have been redundant.

Anyone care to test the PostgreSQL?

P.S. I'd be happy to keep you aboard.

fago’s picture

ah well, so hopefully this brings new life to the project.. :)

@name: yep, copy/paste mistake. My mysql hasn't complained, but anyway let's remove them.

@INDEX: as to my knowledge, for a primary key is anyway an index maintained, so there is no need to specify a further one.

salvis’s picture

acl_user now has an index (the primary key) on (acl_id, uid) — this helps for queries about acl_id alone as well as about acl_id and uid. It does not help for queries about plain uid. That's what the index on uid does.

Feel free to commit #2 if you agree.

fago’s picture

Status: Needs review » Needs work

indeed, thanks for clarifying this :)

from the mysql docs:
If the table has a multiple-column index, any leftmost prefix of the index can be used by the optimizer to find rows. For example, if you have a three-column index on (col1, col2, col3), you have indexed search capabilities on (col1), (col1, col2), and (col1, col2, col3).

however, I think the patch needs some more love now.
* the upgrade path still removes the old indexes
* postgre sql is missing the indexes

salvis’s picture

Status: Needs work » Needs review
StatusFileSize
new5.21 KB

Yes, the upgrade path removed one index too many. The others should be ok, but I've put the removal ahead of the recreation to make sure we only do what we want to do.

As for pgsql, if no one cares, we'll commit anyway — I did massage it a little though, but I don't know whether it works...

fago’s picture

Status: Needs review » Fixed

fine. I've only replaced the index name to be {acl_user}_uid_index, so that the acl_user table prefix is correctly applied.

Otherwise, the code looks good so I've committed it to 5.x-dev. PostgreSQL could still need a tester..

Shiny’s picture

testing on postgres - what's the current state? the patch won't apply cleanly to the end of the DRUPAL-5 branch. Is it already in there?

salvis’s picture

Yes, the patch is already committed to acl 5.x-1.x-dev, but I'm not sure whether the pgsql part really works, so I'd really appreciate your feedback...

Shiny’s picture

It all installs the schema cleanly - looks correct.
will test with forum access next.

salvis’s picture

Great — thank you for checking/testing!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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