The best I have been able to come with is documented at: http://stackoverflow.com/questions/32640043/cannot-detect-cyclic-data-in-an-sqlite-database/32719216#32719216
But a) it is ugly, b) performance impact of all the length(), replace() functions, c) if values end in similar strings, it probably won't work. After some thought, I think the minimum that would solve this problem is to enhance the instr() function to either take a starting position to begin the search or to take an occurrence number to search for. Oracle's version of instr() does both of these (see https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_1103.htm) Postgresql has a specific way of detecting loops, which would be even more robust. It is documented here: https://www.postgresql.org/docs/9.1/static/queries-with.html _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users