bugSavane - Bugs: bug #7926, sv_export / planning export fails...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #7926: sv_export / planning export fails because sql is a protected keyword in MySQL 5

Submitted by:  Colin Turner <ct1972>
Submitted on:  Mon 04 Dec 2006 02:43:32 PM UTC  
 
Category: BackendStatus: Fixed
Severity: 2 - MinorPriority: C - Normal
Assigned to: NoneOpen/Closed: Closed
Release: 3.0Planned Release: 3.0+1
Reproducibility: NonePrivacy: Public

(Jump to the original submission Jump to the original submission)

Tue 05 Dec 2006 09:42:31 AM UTC, comment #10:

On the other hand, as we actually only support MySQL currently, we can afford it, I guess.

Mathieu Roy <yeupou>
Project Administrator
Mon 04 Dec 2006 10:01:55 PM UTC, comment #9:

Actually Mathieu - doing a little research I wonder if this fix makes everything good for MySQL but breaks them for PostgreSQL. I think I've found some references that the latter doesn't like backtick quotes. See for example this.

Colin Turner <ct1972>
Mon 04 Dec 2006 05:44:56 PM UTC, comment #8:

I guessed that. Thanks very much for the speedy attention, the patches you made are exactly as I did here locally.

Colin Turner <ct1972>
Mon 04 Dec 2006 05:30:41 PM UTC, comment #7:

(Ignore my question in comment #4, comment #3 where not posted yet when I started to write comment #4)

Mathieu Roy <yeupou>
Project Administrator
Mon 04 Dec 2006 04:23:42 PM UTC, comment #6:

Ok, so now it should be fixed and I'll repackage release 3.0 because we exactly match relevant cases.

Mathieu Roy <yeupou>
Project Administrator
Mon 04 Dec 2006 04:22:50 PM UTC, SVN revision 6483:

Fix a bug causing export function to be broken with MySQL 5
(bug #7926).

(Browse SVN revision 6483)

Mathieu Roy <yeupou>
Project Administrator
Mon 04 Dec 2006 04:15:59 PM UTC, comment #4:

Are you even able to plan an export?

For the same reason, on a test install running debian testing, I was not even able to plan an export.

Somehow, it seems that recent version of mysql now longer allow sql to be a field name without being escaped, so this bug occurs whenever this field named sql is involved.

I guess it has to do with MySQL 5.

Mathieu Roy <yeupou>
Project Administrator
Mon 04 Dec 2006 04:05:26 PM UTC, comment #3:

Actually, on further examination this problem occurs for me in the frontend too. Attempts to "export" from the trackers fail with a SQL Insert Error.

Examination of the query formed and testing reveals that the PHP trips up in the same place - sql as a column name with MySQL.

Colin Turner <ct1972>
Mon 04 Dec 2006 03:02:02 PM UTC, comment #2:

This is a server installed freshly for savane, using Debian etch (which is of course a slightly moving target at the moment).

I realise that escaping stuff there is inelegant, I'm not really very fluent in Perl and didn't want to poke about too much.

From dpkg --list | grep perl, I guess the most relevant packages are

ii libdbd-mysql-perl 3.0008-1
ii libdbd-pg-perl 1.49-2
ii libdbi-perl 1.53-1
ii perl 5.8.8-6.1
ii perl-base 5.8.8-6.1
ii perl-modules 5.8.8-6.1

The problem was there when the server was initially installed (just after 2.0 release), and eventually I commented out the line in /etc/cron.d till I had more time to look at it. I did a dist-upgrade today of everything from etch and savane.

Anything else I should look at?

Colin Turner <ct1972>
Mon 04 Dec 2006 02:52:14 PM UTC, comment #1:

What is puzzling in the fact that this did not happen on any other installation. Which debian version do you run? Which version of perl dbi is it?

(BTW, escaping stuff should be done using dbi own quote function)

Mathieu Roy <yeupou>
Project Administrator
Mon 04 Dec 2006 02:43:32 PM UTC, original submission:

On my Debian install, sv_export keeps crashing out with

DBD::mysql::st execute failed: 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 'sql, status, date, frequency_day, frequency_hour FROM trackers_export WHERE date' at line 1 at /usr/lib/perl5/Savane/DB.pm line 181.
DBD::mysql::st execute failed: 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 'sql, status, date, frequency_day, frequency_hour FROM trackers_export WHERE date' at line 1 at /usr/lib/perl5/Savane/DB.pm line 181.

After exploring the Perl, I found it was actually the sql column name giving the grief. I have enclosed it in backticks - this is a MySQL only trick though perhaps? I think it's around line 116 of sv_export: (other lines shown for context)

Seems to be working correctly now (I'm not sure, the table is empty).

Colin Turner <ct1972>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by yeupou (Posted a comment)
  • -unavailable- added by ct1972 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 04 Dec 2006 04:23:42 PM UTCyeupouStatusConfirmed=>Fixed
      Planned Release=>3.0+1
      Open/Closed-Automatic update due to transitions settings-=>Closed
    Mon 04 Dec 2006 04:15:59 PM UTCyeupouStatusNeed Info=>Confirmed
      Summarysv_export fails because sql is a protected keyword in MySQL=>sv_export / planning export fails because sql is a protected keyword in MySQL 5
      Open/Closed-Automatic update due to transitions settings-=>Open
    Mon 04 Dec 2006 02:52:14 PM UTCyeupouStatusNone=>Need Info
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup