hello again,

I get the message of error "OperationalError: circular reference: x"
from the recursive CTE below.

Is it a syntax error or a bug ?

  ****

drop table if exists gen9;
drop table if exists genx;
create table gen9(z);
insert into gen9   values
('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
WITH  RECURSIVE x( s, ind ) AS
     (SELECT sud, instr( sud, ' ') as w  from
(SELECT '53  7    6  195    98    6 8   6   34  8 3  17   2   6 6    28
419  5    8  79'  AS sud
 UNION ALL
  SELECT substr( s, 1, ind - 1 ) || z || substr( s, ind + 1 )
       ,
instr(substr('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',1,
ind)
       || substr( s, ind + 1 ), ' ' ) as sud
  FROM x     ,   gen9 as z
  WHERE ind > 0
  AND NOT EXISTS ( SELECT NULL
                   FROM gen9 as lp
                   WHERE z.z = substr( s, ( (ind - 1 ) / 9 ) * 9 +lp.z, 1 )
                   OR    z.z = substr( s, ind -(( ind - 1)/ 9 ) - 8 + lp.z
* 9, 1 )
                   OR    z.z = substr( s, (( ind - 1 ) / 3 - ( ( ind - 1 )
/ 3 )/ 3 ) * 3
                                      + ( ( ind - 1 ) / 27 ) * 27 + lp.z
                                      + ( ( lp.z - 1 ) / 3 ) * 6
                                   , 1 )
                 )))

SELECT s FROM x WHERE ind = 0;
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to