package libapache-dbilogger-perl
submitter 41890 !
retitle 41890 libapache-dbilogger-perl: Incompatible with PostgreSQL due to 
unquoted column names
tags 41890 patch
thanks

Gunnar Wolf wrote:
> I want to close a pretty old bug ( #41890! :-O ). It requires a minor
> change in libapache-dbilogger-perl - Setting the column "user" to a
> SQL-legal name (it seems it was meant for MySQL, which is quite
> relaxed on what it accepts - I don't know if this problem would still
> show up with a current Postgres, but using 'user' as a column name is
> definitively not nice). 

You do not have to make an incompatible change.  "user" is very well
allowed as a column name in PostgreSQL, you just have to double-quote it
to distinguish it from the "user" keyword:

| CREATE TABLE requests (
|     server varchar(127) DEFAULT '' NOT NULL,
|     bytes mediumint(9) DEFAULT '0' NOT NULL,
|     "user" varchar(15) DEFAULT '' NOT NULL,
|     [...]
| );

Perhaps a PostgreSQL-specific note in the docs for the table creation
would be appropriate.

In any case, a code change (though not an incompatible one) is necessary
in order to make Apache::DBILogger actually work with such a table under
PostgreSQL:

The module must properly use SQL quoting, which is supported by DBI.  The
module actually quotes the to-be-inserted values already, but not the
column names.

Here is a minimally invasive patch for the required code changes.

Attachment: libapache-dbilogger-perl-0.93-SQL-quoting.diff
Description: Binary data

Reply via email to