dolthub / doltgresql

DoltgreSQL - Version Controlled PostgreSQL
Apache License 2.0
1.12k stars 25 forks source link

support `with` #945

Closed jycor closed 2 weeks ago

jycor commented 2 weeks ago

somewhat related: https://github.com/dolthub/doltgresql/issues/928

github-actions[bot] commented 2 weeks ago
Main PR
Total 42090 42090
Successful 14404 14415
Failures 27686 27675
Partial Successes[^1] 4697 4692
Main PR
Successful 34.2219% 34.2480%
Failures 65.7781% 65.7520%

${\color{lightgreen}Progressions}$

rules

QUERY: create view rule_v1 as values(1,2);
QUERY: drop view rule_v1;

with

QUERY: WITH q1(x,y) AS (SELECT 1,2)
SELECT * FROM q1, q1 AS q2;
QUERY: WITH RECURSIVE t(n) AS (
    SELECT (VALUES(1))
UNION ALL
    SELECT n+1 FROM t WHERE n < 5
)
SELECT * FROM t;
QUERY: WITH RECURSIVE t(n) AS (
    SELECT 1
UNION
    SELECT 10-n FROM t)
SELECT * FROM t;
QUERY: WITH RECURSIVE t(n) AS (
    VALUES (1)
UNION ALL
    SELECT n+1 FROM t)
SELECT * FROM t LIMIT 10;
QUERY: WITH RECURSIVE t(n) AS (
    SELECT 1
UNION
    SELECT n+1 FROM t)
SELECT * FROM t LIMIT 10;
QUERY: WITH q1(x,y) AS (
    SELECT hundred, sum(ten) FROM tenk1 GROUP BY hundred
  )
SELECT count(*) FROM q1 WHERE y > (SELECT sum(y)/100 FROM q1 qsub);
QUERY: WITH RECURSIVE t(i,j) AS (
    VALUES (1,2)
    UNION ALL
    SELECT t2.i, t.j+1 FROM
        (SELECT 2 AS i UNION ALL SELECT 3 AS i) AS t2
        JOIN t ON (t2.i = t.i+1))
    SELECT * FROM t;
QUERY: WITH RECURSIVE
  y (id) AS (VALUES (1)),
  x (id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM x WHERE id < 5)
SELECT * FROM x;
QUERY: WITH RECURSIVE
   x(id) AS
     (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 5),
   y(id) AS
     (VALUES (1) UNION ALL SELECT id+1 FROM y WHERE id < 10)
 SELECT y.*, x.* FROM y LEFT JOIN x USING (id);
QUERY: WITH RECURSIVE
   x(id) AS
     (SELECT 1 UNION ALL SELECT id+1 FROM x WHERE id < 3 ),
   y(id) AS
     (SELECT * FROM x UNION ALL SELECT * FROM x),
   z(id) AS
     (SELECT * FROM x UNION ALL SELECT id+1 FROM z WHERE id < 10)
 SELECT * FROM z;
QUERY: WITH RECURSIVE
   x(id) AS
     (SELECT 1 UNION ALL SELECT id+1 FROM x WHERE id < 3 ),
   y(id) AS
     (SELECT * FROM x UNION ALL SELECT * FROM x),
   z(id) AS
     (SELECT * FROM y UNION ALL SELECT id+1 FROM z WHERE id < 10)
 SELECT * FROM z;
QUERY: with cte(foo) as ( values(42) ) values((select foo from cte));
QUERY: with ordinality as (select 1 as x) select * from ordinality;
QUERY: with with_test as (select 42) insert into with_test select * from with_test;
QUERY: select * from with_test;

[^1]: These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.