@@ -48,20 +48,20 @@ Recursive CTEs enable the implementation of the following task. Suppose we have
48
48
49
49
~~~ sql
50
50
WITH RECURSIVE
51
- folders(path_old) AS (
52
- VALUES
53
- (' doc/thesis/exp' ),
54
- (' doc/thesis/theory' ),
55
- (' doc/app/job/lor' ),
56
- (' code/scripts/py' ),
57
- (' code/scripts/bas' )
58
- ),
51
+ folders(path_old) AS (
52
+ VALUES
53
+ (' doc/thesis/exp' ),
54
+ (' doc/thesis/theory' ),
55
+ (' doc/app/job/lor' ),
56
+ (' code/scripts/py' ),
57
+ (' code/scripts/bas' )
58
+ ),
59
59
ops(opid, rootpath_old, rootpath_new) AS (
60
60
VALUES
61
- (1 , ' doc/' , ' docABC' ),
62
- (2 , ' docABC/thesis/' , ' docABC/master' ),
63
- (3 , ' docABC/app/job/' , ' docABC/app/academic_job' ),
64
- (4 , ' code/' , ' prog' )
61
+ (1 , ' doc/' , ' docABC' ),
62
+ (2 , ' docABC/thesis/' , ' docABC/master' ),
63
+ (3 , ' docABC/app/job/' , ' docABC/app/academic_job' ),
64
+ (4 , ' code/' , ' prog' )
65
65
),
66
66
LOOP_COPY AS (
67
67
-- Initial SELECT --
@@ -75,7 +75,7 @@ WITH RECURSIVE
75
75
UNION ALL
76
76
-- Append the processing queue with new paths generated by the current operation
77
77
SELECT ops .opid ,
78
- rootpath_new || substr(path_new, length(rootpath_old)) AS path_new
78
+ rootpath_new || substr(path_new, length(rootpath_old)) AS path_new
79
79
FROM LOOP_COPY AS BUFFER, ops
80
80
WHERE ops .opid = BUFFER .opid + 1
81
81
AND BUFFER .path_new like rootpath_old || ' %'
0 commit comments