Bug #13040 Creation of partition table fails with ps-protocol
Submitted: 7 Sep 2005 14:20 Modified: 7 Sep 2005 16:25
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:mysql-5.1.2 OS:Linux (linux)
Assigned to: Mikael Ronström CPU Architecture:Any

[7 Sep 2005 14:20] Magnus Blåudd
Description:
When creating a partition table and mysql-test-run.pl is run with the --ps-protocol flag, the creation will fail with the error message: "1064: Constant/Random expression in (sub)partitioning function is not allowed near ')
partitions 3..."

Using --ps-protocol means that the query will pass through  Prepared_statement::prepare and my gues is some uninted var that makes the difference.
 

How to repeat:
./mysql-test-run.pl --do-test=partition --ps-protocol
Has ndbcluster support
Killing Possible Leftover Processes
Removing Stale Files
Installing Master Databases
Installing Master Databases
Installing Slave Databases
Installing Slave Databases
Installing Slave Databases
Creating IM password file (/home/msvensson/mysql/mysql-5.1/mysql-test/var/im.passwd)
Installing Im_mysqld_1 Databases
Installing Im_mysqld_2 Databases
Install ndbcluster
Starting ndbd
Starting ndbd
Waiting for started...
NDBT_ProgramExit: 0 - OK
Connected to Management Server at: localhost:9350
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=1    @127.0.0.1  (Version: 5.1.2, Nodegroup: 0, Master)
id=2    @127.0.0.1  (Version: 5.1.2, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=3    @127.0.0.1  (Version: 5.1.2)

[mysqld(API)]   4 node(s)
id=4 (not connected, accepting connect from any host)
id=5 (not connected, accepting connect from any host)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)

=======================================================
Finding  Tests in the 'main' suite
Starting Tests in the 'main' suite

TEST                            RESULT
-------------------------------------------------------

partition                       [ fail ]
Errors are (from /home/msvensson/mysql/mysql-5.1/mysql-test/var/log/mysqltest-time) :
mysqltest: At line 95: query 'CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by list (a)
partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
partition x2 values in (3, 11, 5, 7) tablespace ts2,
partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3)' failed: 1064: Constant/Random expression in (sub)partitioning function is not allowed near ')
partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
partition x2 va' at line 6
(the last lines may be the most important ones)

Aborting: partition failed in ps-protocol mode. To continue, re-run with '--force'.
Ending Tests
Shutting-down MySQL daemon

Master(s) shutdown finished
Slave(s) shutdown finished
[7 Sep 2005 14:31] Mikael Ronström
This bug is due to a merge error
the line lex->safe_to_cache_query= 0;
should be before the call to yyparse, not after the call
[7 Sep 2005 15:30] Mikael Ronström
Oops, comment should be other way around.
In sql_prepare.cc the variable
safe_to_cache_query is initialised to TRUE in lex_start
and this needs to be the case when calling yyparse
and prepared statements should always set this variable but it
needs to be done after calling yyparse, otherwise the partition
code will believe the partition function is a constant expression.
[7 Sep 2005 16:25] Mikael Ronström
Fixed
[19 Oct 2005 10:48] Jon Stephens
Changed category to Server/Partitioning.