Skip to content

Commit 1900f4b

Browse files
Add legacy-13.zip with SQL files from passing tests
- Created legacy-13/ folder with 110 SQL files from passing tests - Maintained original directory structure from __fixtures__ - Generated legacy-13.zip archive for easy distribution - Added create-legacy-zip.js script for reproducibility - Files correspond exactly to those in generated.json (no xit/skipped tests) Co-Authored-By: Dan Lynch <[email protected]>
1 parent c93a641 commit 1900f4b

File tree

112 files changed

+7907
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+7907
-0
lines changed

create-legacy-zip.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const generatedJsonPath = './generated.json';
5+
const fixturesDir = './__fixtures__';
6+
const outputDir = './legacy-13';
7+
8+
function createDirectoryStructure(filePath) {
9+
const dir = path.dirname(filePath);
10+
if (!fs.existsSync(dir)) {
11+
fs.mkdirSync(dir, { recursive: true });
12+
}
13+
}
14+
15+
function main() {
16+
console.log('Reading generated.json to get fixture paths...');
17+
const generatedData = JSON.parse(fs.readFileSync(generatedJsonPath, 'utf8'));
18+
const fixturePaths = Object.keys(generatedData);
19+
20+
console.log(`Found ${fixturePaths.length} fixture files to copy`);
21+
22+
if (fs.existsSync(outputDir)) {
23+
console.log('Removing existing legacy-13 directory...');
24+
fs.rmSync(outputDir, { recursive: true, force: true });
25+
}
26+
27+
fs.mkdirSync(outputDir, { recursive: true });
28+
29+
let copiedCount = 0;
30+
let errorCount = 0;
31+
32+
for (const fixturePath of fixturePaths) {
33+
const sourcePath = path.join(fixturesDir, fixturePath);
34+
const destPath = path.join(outputDir, fixturePath);
35+
36+
try {
37+
createDirectoryStructure(destPath);
38+
39+
if (fs.existsSync(sourcePath)) {
40+
fs.copyFileSync(sourcePath, destPath);
41+
copiedCount++;
42+
console.log(`Copied: ${fixturePath}`);
43+
} else {
44+
console.error(`Source file not found: ${sourcePath}`);
45+
errorCount++;
46+
}
47+
} catch (error) {
48+
console.error(`Error copying ${fixturePath}:`, error.message);
49+
errorCount++;
50+
}
51+
}
52+
53+
console.log(`\nSummary:`);
54+
console.log(`- Successfully copied: ${copiedCount} files`);
55+
console.log(`- Errors: ${errorCount} files`);
56+
console.log(`- Output directory: ${outputDir}`);
57+
58+
console.log('\nDirectory structure created:');
59+
function listDirectory(dir, prefix = '') {
60+
const items = fs.readdirSync(dir, { withFileTypes: true });
61+
items.forEach((item, index) => {
62+
const isLast = index === items.length - 1;
63+
const currentPrefix = prefix + (isLast ? '└── ' : '├── ');
64+
console.log(currentPrefix + item.name);
65+
66+
if (item.isDirectory()) {
67+
const nextPrefix = prefix + (isLast ? ' ' : '│ ');
68+
listDirectory(path.join(dir, item.name), nextPrefix);
69+
}
70+
});
71+
}
72+
73+
if (fs.existsSync(outputDir)) {
74+
listDirectory(outputDir);
75+
}
76+
}
77+
78+
if (require.main === module) {
79+
main();
80+
}

legacy-13.zip

78 KB
Binary file not shown.

legacy-13/a_expr.sql

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
CREATE VIEW superschema.app_authorized_grants AS
2+
SELECT
3+
coalesce(nullif(s[1], ''), 'PUBLIC') as grantee,
4+
relname as table_name,
5+
nspname as table_schema,
6+
string_agg(s[2], ', ') as privileges,
7+
relkind as table_type
8+
FROM
9+
pg_class c
10+
join pg_namespace n on n.oid = relnamespace
11+
join pg_roles r on r.oid = relowner,
12+
unnest(coalesce(relacl::text[], format('{%%s=arwdDxt/%%s}', rolname, rolname)::text[])) acl,
13+
regexp_split_to_array(acl, '=|/') s
14+
WHERE (s[1] = 'authenticated' or s[1] is null) and nspname not in ('pg_catalog', 'information_schema', 'pg_toast')
15+
GROUP BY grantee, table_name, table_schema, relkind
16+
ORDER BY relkind != 'r', relkind != 'v', relkind != 'm', relkind != 'i', relkind, nspname, relname;
17+
18+
-- AEXPR_OP
19+
select a = b;
20+
21+
-- AEXPR_OP_ANY
22+
SELECT foo = ANY(x) FROM vtable;
23+
24+
-- AEXPR_OP_ALL
25+
SELECT foo = ALL(x) FROM vtable;
26+
27+
-- AEXPR_DISTINCT
28+
-- AEXPR_NOT_DISTINCT
29+
30+
SELECT foo,bar FROM vtable WHERE foo IS DISTINCT FROM bar;
31+
SELECT foo,bar FROM vtable WHERE foo IS NOT DISTINCT FROM bar;
32+
33+
SELECT t1.foo,t1.bar,t1.baz
34+
FROM t1
35+
LEFT OUTER JOIN t2 ON (
36+
t1.foo IS NOT DISTINCT FROM t2.foo
37+
AND t1.bar IS NOT DISTINCT FROM t2.bar
38+
AND t1.baz IS NOT DISTINCT FROM t2.baz
39+
)
40+
WHERE ( t2.foo IS NULL );
41+
42+
43+
44+
-- AEXPR_NULLIF
45+
46+
select nullif(null, '');
47+
48+
-- AEXPR_OF
49+
50+
SELECT x, x IS OF (text) AS is_text FROM q;
51+
SELECT x, x IS NOT OF (text) AS is_text FROM q;
52+
SELECT COALESCE(4::domainint4, 7::domainint4) IS OF ( domainint4 ) AS t;
53+
54+
-- AEXPR_IN
55+
56+
SELECT
57+
value IN (SELECT column_name FROM table_name);
58+
59+
SELECT
60+
value NOT IN (SELECT column_name FROM table_name);
61+
62+
SELECT customer_id,
63+
rental_id,
64+
return_date
65+
FROM
66+
rental
67+
WHERE
68+
customer_id IN (1, 2)
69+
ORDER BY
70+
return_date DESC;
71+
72+
73+
SELECT
74+
customer_id,
75+
rental_id,
76+
return_date
77+
FROM
78+
rental
79+
WHERE
80+
customer_id NOT IN (1, 2);
81+
82+
SELECT
83+
customer_id,
84+
rental_id,
85+
return_date
86+
FROM
87+
rental
88+
WHERE
89+
customer_id <> 1
90+
AND customer_id <> 2;
91+
92+
SELECT *
93+
FROM Employees
94+
WHERE name IN ('James John', 'Mercy Bush', 'Kate Joel');
95+
96+
SELECT *
97+
FROM Employees
98+
WHERE name NOT IN ('James John', 'Mercy Bush', 'Kate Joel');
99+
100+
SELECT customer_id
101+
FROM rental
102+
WHERE CAST (return_date AS DATE) = '2005-05-27'
103+
ORDER BY customer_id;
104+
105+
SELECT
106+
customer_id,
107+
first_name,
108+
last_name
109+
FROM
110+
customer
111+
WHERE
112+
customer_id IN (
113+
SELECT customer_id
114+
FROM rental
115+
WHERE CAST (return_date AS DATE) = '2005-05-27'
116+
)
117+
ORDER BY customer_id;
118+
119+
-- AEXPR_LIKE
120+
121+
SELECT * FROM student WHERE name LIKE 'a%';
122+
SELECT * FROM student WHERE name NOT LIKE 'a%';
123+
SELECT
124+
'foo' LIKE 'foo',
125+
'foo' LIKE 'f%',
126+
'foo' LIKE '_o_',
127+
'bar' LIKE 'b_';
128+
129+
-- AEXPR_ILIKE
130+
131+
SELECT * FROM student WHERE name ILIKE 'a%';
132+
SELECT * FROM student WHERE name NOT ILIKE 'a%';
133+
134+
135+
-- AEXPR_SIMILAR
136+
137+
select 'xyz' SIMILAR TO 'xyz';
138+
select 'xyz' SIMILAR TO 'x';
139+
select 'xyz' SIMILAR TO '%(y|a)%';
140+
select 'xyz' SIMILAR TO '(y|z)%';
141+
142+
select 'xyz' SIMILAR TO 'xyz' ESCAPE 'x';
143+
select 'xyz' SIMILAR TO 'x' ESCAPE 'x';
144+
select 'xyz' SIMILAR TO '%(y|a)%' ESCAPE 'x';
145+
select 'xyz' SIMILAR TO '(y|z)%' ESCAPE 'x';
146+
147+
select 'xyz' NOT SIMILAR TO 'xyz';
148+
select 'xyz' NOT SIMILAR TO 'x';
149+
select 'xyz' NOT SIMILAR TO '%(y|a)%';
150+
select 'xyz' NOT SIMILAR TO '(y|z)%';
151+
152+
select 'xyz' NOT SIMILAR TO 'xyz' ESCAPE 'x';
153+
select 'xyz' NOT SIMILAR TO 'x' ESCAPE 'x';
154+
select 'xyz' NOT SIMILAR TO '%(y|a)%' ESCAPE 'x';
155+
select 'xyz' NOT SIMILAR TO '(y|z)%' ESCAPE 'x';
156+
157+
-- AEXPR_BETWEEN
158+
-- AEXPR_NOT_BETWEEN
159+
-- AEXPR_BETWEEN_SYM
160+
-- AEXPR_NOT_BETWEEN_SYM
161+
162+
select * from generate_series(1,10) as numbers(a)
163+
where numbers.a between symmetric 6 and 3;
164+
165+
select * from generate_series(1,10) as numbers(a)
166+
where numbers.a between 6 and 3;
167+
168+
select * from generate_series(1,10) as numbers(a)
169+
where numbers.a not between symmetric 6 and 3;
170+
171+
select * from generate_series(1,10) as numbers(a)
172+
where numbers.a not between 6 and 3;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ALTER TABLE public.table1 ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
2+
SEQUENCE NAME public.table1
3+
START WITH 1
4+
INCREMENT BY 1
5+
NO MINVALUE
6+
NO MAXVALUE
7+
CACHE 1
8+
)

0 commit comments

Comments
 (0)