Closed
Description
Describe the bug
Postgres should support CREATE TABLE AS
Database Engine
PostgreSQL
To Reproduce
<!DOCTYPE html>
<html lang="en">
<head>
<title>node-sql-parser</title>
<meta charset="utf-8" />
</head>
<body>
<pre id="query"></pre>
<script src="https://unpkg.com/node-sql-parser@5.3.1/umd/index.umd.js"></script>
<script>
window.onload = function () {
// Example parser
const parser = new NodeSQLParser.Parser();
const ast = parser.astify('create table test as select 1', {
database: 'postgresql',
});
console.log(ast);
document.getElementById('query').innerHTML =
'Query: ' + parser.sqlify(ast);
document.body.innerHTML += `<pre>${JSON.stringify(ast, null, 2)}</pre>`;
const sql = parser.sqlify(ast);
console.log(sql);
};
</script>
</body>
</html>
Expected behavior
Should be able to parse the query
Additional context
Same query parses well when using mysql
: