To reproduce:
const { parse, deparse } = require('pgsql-parser');
async function main() {
const stmts = parse(`
ALTER TABLE public.table1 ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
SEQUENCE NAME public.table1
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
`)
console.log(stmts)
const stmts2 = deparse(stmts[0])
console.log(stmts2)
}
main()
yarn run v1.22.10
[ { RawStmt: { stmt: [Object], stmt_len: 266 } } ]
ALTER TABLE public.table1 ;
Done in 0.41s.
It should re-print the whole statement. Please let me know if any information is required from my side.