|
| 1 | +const parse = require('@pgsql/parser').default; |
| 2 | + |
| 3 | +const testSQL = `DROP TABLE num_data;`; |
| 4 | + |
| 5 | +console.log("Investigating structural differences between PG13 and PG14...\n"); |
| 6 | + |
| 7 | +try { |
| 8 | + const result13 = parse(testSQL, { version: '13' }); |
| 9 | + const result14 = parse(testSQL, { version: '14' }); |
| 10 | + |
| 11 | + console.log("=== PG13 Structure ==="); |
| 12 | + console.log(JSON.stringify(result13, null, 2)); |
| 13 | + |
| 14 | + console.log("\n=== PG14 Structure ==="); |
| 15 | + console.log(JSON.stringify(result14, null, 2)); |
| 16 | + |
| 17 | + const json13 = JSON.stringify(result13); |
| 18 | + const json14 = JSON.stringify(result14); |
| 19 | + |
| 20 | + console.log("\n=== String Node Analysis ==="); |
| 21 | + const stringMatches13 = json13.match(/"String":\s*{[^}]*}/g) || []; |
| 22 | + const stringMatches14 = json14.match(/"String":\s*{[^}]*}/g) || []; |
| 23 | + |
| 24 | + console.log("PG13 String nodes:", stringMatches13); |
| 25 | + console.log("PG14 String nodes:", stringMatches14); |
| 26 | + |
| 27 | + console.log("\n=== Field Analysis ==="); |
| 28 | + console.log("PG13 has 'str' field:", json13.includes('"str":')); |
| 29 | + console.log("PG14 has 'str' field:", json14.includes('"str":')); |
| 30 | + console.log("PG13 has 'sval' field:", json13.includes('"sval":')); |
| 31 | + console.log("PG14 has 'sval' field:", json14.includes('"sval":')); |
| 32 | + |
| 33 | +} catch (error) { |
| 34 | + console.log("Parse error:", error.message); |
| 35 | +} |
0 commit comments