Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pglast/printers/ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,10 @@ def alter_stats_stmt(node, output):
output.write('IF EXISTS ')
output.print_name(node.defnames)
output.write(' SET STATISTICS ')
output.print_node(node.stxstattarget)
if node.stxstattarget is None:
output.write('DEFAULT')
else:
output.print_node(node.stxstattarget)


class AlterSubscriptionTypePrinter(IntEnumPrinter):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_printers_roundtrip/ddl/alter_statistics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER STATISTICS st SET STATISTICS 100

ALTER STATISTICS IF EXISTS myschema.st SET STATISTICS DEFAULT