Re: [mysql 5.0, connection loss, procedure-related, easy to reproduce, detailed report] what you ever wanted to know about trees

2004-01-20 Thread Victoria Reznichenko
Stefan Traby [EMAIL PROTECTED] wrote:
 Hi !
 
 mysql 5.0 is _really_ cool.
 
 this bug should be reproducable:

Thank you for bug report! It was entered to the bug database as
http://bugs.mysql.com/2460
 
 
 ( cat table.sql ; ./populate.pl ; ./perfect_game.pl 32 ) | mysql test
 
 after that executing the same procedure with same parameter again,
 the connection is lost:
 
 --
 mysql call self_and_up(1);
 +---+
 | id|
 +---+
 | 1 |
 |  1999 |
 |   399 |
 |79 |
 |15 |
 | 2 |
 +---+
 6 rows in set (0.20 sec)
 
 Query OK, 0 rows affected (0.20 sec)
 
 mysql call self_and_up(1);
 ERROR 2013 (HY000): Lost connection to MySQL server during query
 mysql
 --
 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



[mysql 5.0, connection loss, procedure-related, easy to reproduce, detailed report] what you ever wanted to know about trees

2004-01-16 Thread Stefan Traby
Hi !

mysql 5.0 is _really_ cool.

this bug should be reproducable:


( cat table.sql ; ./populate.pl ; ./perfect_game.pl 32 ) | mysql test

after that executing the same procedure with same parameter again,
the connection is lost:

--
mysql call self_and_up(1);
+---+
| id|
+---+
| 1 |
|  1999 |
|   399 |
|79 |
|15 |
| 2 |
+---+
6 rows in set (0.20 sec)

Query OK, 0 rows affected (0.20 sec)

mysql call self_and_up(1);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql
--



use cut and paste:

==
table.sql
==
-- table.sql

drop table if exists node;
create table node ( id int unsigned not null,
rid int unsigned not null,
msg text not null,
primary key(id),
unique index(rid,id)
 );
--


==
populate.pl
==
#!/usr/bin/perl
# populate.pl - [EMAIL PROTECTED]

our $level = 0;
our $parent = 0;
our @nodes;

sub rec() {
   for my $i (1..$lim) {
  my $node = $parent*$lim+$i;
  $nodes[$level] = $node; 
  print insert into node (id, rid, msg) values ($node, $parent, \.join(-, 0, 
@nodes[0..$level]).\);\n;
  {
local $parent = $node;
local $level = $level+1;
rec() if $level  $rec_depth;
  }
   }
} 

sub populate_table(@) {
my %args = @_;
   {
 local $lim = $args{count} || 2;
 local $rec_depth = $args{depth} || 2;
 rec;
   }
}

populate_table count = 5, depth = 6;
--


==
perfect_game.pl
==
#!/usr/bin/perl
# perfect_game.pl - [EMAIL PROTECTED]

sub query_parents_union(@) {
  my %a = @_;
  my $level = $a{max_level} || 0;
  my $proc = $a{proc} || dummy;
  my $s = select . join(,, map( { n0.$_ } @{$a{fields}}));
  my $o = drop procedure if exists $proc;\n
 .delimiter |\n
 .create procedure $proc (IN v INT)\n
 .begin\n;

  for(my $x = 0; $x = $level; $x++) {
 $o .=  \n($s\n\tfrom .join(, , map( { $a{table} as n$_ } ( 
0..$x))).\n\twhere (
  .\n\t\t(
.join( and , map( { n$_.$a{id} = .(($_ = $x) ? v : 
n.($_+1)..$a{rid}) } (0..$x))).)
  .\n\t\t)\n);
 $o .=\nunion if $x != $level;
  }
  $o
  .;\n
  .end |\n
  .delimiter ;\n
}

my $limit = $ARGV[0] || 0;
  print query_parents_union(table = 'node', id = 'id', rid = 'rid', fields = [ 
'id' ], proc = self_and_up, max_level = $limit);
--


-- 

  ciao - 
Stefan

aclocal - emit a warning if -ac kernel is used. 

Stefan TrabyLinux/ia32 office: +49-721-3523165
Mathystr. 18-20 V/8 Linux/alpha  cell: +XX-XXX-XXX
76133 Karlsruhe Linux/sparc   http://graz03.kwc.at
Germany Linux/arm   mailto:[EMAIL PROTECTED]
Europe  Linux/mips mailto:[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]