<?xml version="1.0" encoding="utf-8"?>
<launchpad-bug id="986731">
  <date_last_updated>2012-04-22 01:00:30.103676+00:00</date_last_updated>
  <api_links>
    <bug_api_link>https://api.launchpad.net/1.0/bugs/986731</bug_api_link>
    <bug_owner_link>https://api.launchpad.net/1.0/~elenst</bug_owner_link>
    <milestone_link>https://api.launchpad.net/1.0/maria/+milestone/5.1</milestone_link>
    <linked_branches_collection_link>https://api.launchpad.net/1.0/bugs/986731/linked_branches</linked_branches_collection_link>
    <activity_link>https://api.launchpad.net/1.0/bugs/986731/activity</activity_link>
  </api_links>
  <bug_web_link>https://bugs.launchpad.net/bugs/986731</bug_web_link>
  <owner>Elena Stepanova</owner>
  <assignee>Sergey Petrunia</assignee>
  <milestone_title>Maria 5.1</milestone_title>
  <duplicate_link></duplicate_link>
  <duplicate_bug_id></duplicate_bug_id>
  <title>sql-bench/test-table-elimination fails with SQL syntax error in LOCK TABLES if executed with --lock-tables</title>
  <status>New</status>
  <importance>Low</importance>
  <created>2012-04-22 00:15:07.395896+00:00</created>
  <description>
<![CDATA[Initially reported in the KB as http://kb.askmonty.org/en/test-table-elimination-fails.

If sql-bench/test-table-elimination is started with --lock-tables (or --fast), it attempts to execute the following command:

LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE

and reasonably fails with a syntax error, as it is not a valid statement: each table should be followed by a lock type separately.

The following change fixes this particular problem

95c95
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");
207c207
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");

but then another one reveals: 

testing full facts facts table
Error occured with execute(select * from elim_current_facts where id=30246.3207346651)
 -> Table 'F' was not locked with LOCK TABLES

This happens because the view elim_current_facts addresses the table elim_facts through its alias F, which is not locked explicitly. So, I also added the view itself into the LOCK statement:


95c95
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_current_facts WRITE, elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");
207c207
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_current_facts WRITE, elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");

Now it passes.


bzr version-info
revision-id: <email address hidden>
date: 2012-04-06 13:31:33 +0500
build-date: 2012-04-22 04:12:58 +0400
revno: 3146

According to the script code, should also be reproducible on 5.2-5.5.

To reproduce,
- start MariaDB server;
- run perl test-table-elimination --socket=<path to socket> --lock-tables]]>  </description>
  <activities>
    <activity datechanged="2012-04-22T00:15:07.395896+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[]]>      </newvalue>
      <whatchanged>bug</whatchanged>
      <person>Elena Stepanova</person>
      <message>added bug</message>
    </activity>
    <activity datechanged="2012-04-22T01:00:29.994004+00:00">
      <oldvalue>
<![CDATA[sql-bench/test-table-elimination fails with SQL syntax error if executed with --lock-tables]]>      </oldvalue>
      <newvalue>
<![CDATA[sql-bench/test-table-elimination fails with SQL syntax error in LOCK TABLES if executed with --lock-tables]]>      </newvalue>
      <whatchanged>summary</whatchanged>
      <person>Elena Stepanova</person>
      <message></message>
    </activity>
  </activities>
  <comments>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/986731/comments/0" datecreated="2012-04-22T00:15:07.395896+00:00">
      <person>Elena Stepanova</person>
      <subject>
<![CDATA[sql-bench/test-table-elimination fails with SQL syntax error if executed with --lock-tables]]>      </subject>
      <content>
<![CDATA[Initially reported in the KB as http://kb.askmonty.org/en/test-table-elimination-fails.

If sql-bench/test-table-elimination is started with --lock-tables (or --fast), it attempts to execute the following command:

LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE

and reasonably fails with a syntax error, as it is not a valid statement: each table should be followed by a lock type separately.

The following change fixes this particular problem

95c95
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");
207c207
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");

but then another one reveals: 

testing full facts facts table
Error occured with execute(select * from elim_current_facts where id=30246.3207346651)
 -> Table 'F' was not locked with LOCK TABLES

This happens because the view elim_current_facts addresses the table elim_facts through its alias F, which is not locked explicitly. So, I also added the view itself into the LOCK statement:


95c95
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_current_facts WRITE, elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");
207c207
<   do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");
---
>   do_query($dbh,"LOCK TABLES elim_current_facts WRITE, elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");

Now it passes.


bzr version-info
revision-id: holyfoot@askmonty.org-20120406083133-j6s0hqnkaimuct1r
date: 2012-04-06 13:31:33 +0500
build-date: 2012-04-22 04:12:58 +0400
revno: 3146

According to the script code, should also be reproducible on 5.2-5.5.

To reproduce,
- start MariaDB server;
- run perl test-table-elimination --socket=<path to socket> --lock-tables]]>      </content>
    </comment>
  </comments>
</launchpad-bug>
