Bug 66010 - mod_authz_dbd doc select-groups example fails on reserved word group in Mysql
Summary: mod_authz_dbd doc select-groups example fails on reserved word group in Mysql
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_authz_dbd (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-12 15:51 UTC by Chris Lott
Modified: 2022-04-20 16:51 UTC (History)
0 users



Attachments
Documentation fix (1.41 KB, patch)
2022-04-13 10:43 UTC, Giovanni Bechis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lott 2022-04-12 15:51:20 UTC
Please consider this report of a minor documentation bug. The documentation for Apache module mod_authz_dbd at https://httpd.apache.org/docs/2.4/mod/mod_authz_dbd.html suggests using this SQL select statement to query a database for a user's group memberships:

    AuthzDBDQuery "SELECT group FROM authz WHERE user = %s"

I'm using Mysql via the APR mysql library.  The Mysql server seems to treat 'group' as a reserved word. On apache HTTPD server startup this error appears:

[Tue Apr 12 15:39:06.673658 2022] [dbd:error] [pid 9:tid 140197568732480] (20014)Internal error (specific information not available): AH00632: failed to prepare SQL statements: 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 'group FROM authz WHERE user = ?' at line 1

I suggest changing this doc example to use back-ticks, altho that might be hopelessly specific to Mysql:

    AuthzDBDQuery "SELECT `group` FROM authz WHERE user = %s"

Alternately you might avoid the reserved word entirely and use something like this:

    AuthzDBDQuery "SELECT user_group FROM authz WHERE user = %s"

It might also help if you add a note about the reserved word 'group'.

Thanks for listening!
Comment 1 Giovanni Bechis 2022-04-13 10:43:02 UTC
Created attachment 38246 [details]
Documentation fix

Documentation fix that should be enough to address the issue.
Comment 2 Chris Lott 2022-04-20 11:35:27 UTC
Thanks for the quick reply, the patch looks great!
Comment 3 Giovanni Bechis 2022-04-20 16:51:38 UTC
Fixed in r1900077.