Skip to content

Commit

Permalink
Merge from v5
Browse files Browse the repository at this point in the history
  • Loading branch information
lelit committed Jan 22, 2024
2 parents 51322d2 + b3fc527 commit 452f998
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ Version 6
Version 5
#########

5.9 (2024-01-22)
~~~~~~~~~~~~~~~~

- Fix issue `143`__, affecting ``AlterOwnerStmt`` and ``RenameStmt`` printers

__ https://github.com/lelit/pglast/issues/143


5.8 (2024-01-11)
~~~~~~~~~~~~~~~~

Expand Down
6 changes: 3 additions & 3 deletions pglast/printers/ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# :Created: gio 09 nov 2017 10:50:30 CET
# :Author: Lele Gaifax <lele@metapensiero.it>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2017, 2018, 2019, 2020, 2021, 2022, 2023 Lele Gaifax
# :Copyright: © 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Lele Gaifax
#

import re
Expand Down Expand Up @@ -287,7 +287,7 @@ def alter_owner_stmt(node, output):
OT = enums.ObjectType
if node.objectType in (OT.OBJECT_OPFAMILY,
OT.OBJECT_OPCLASS):
method, name = node.object
method, *name = node.object
output.print_name(name)
output.write(' USING ')
output.print_symbol(method)
Expand Down Expand Up @@ -3054,7 +3054,7 @@ def rename_stmt(node, output):
elif node.relation:
output.print_node(node.relation)
elif objtype in (OT.OBJECT_OPFAMILY, OT.OBJECT_OPCLASS):
method, name = node.object
method, *name = node.object
output.print_name(name)
output.write(' USING ')
output.print_symbol(method)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_printers_roundtrip/ddl/alter_owner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ ALTER VIEW v1 OWNER TO rol2
ALTER TABLE t1 OWNER TO rol3

ALTER SCHEMA schema1 OWNER TO rol4

ALTER OPERATOR CLASS public.ean13_ops USING btree OWNER TO postgres
2 changes: 2 additions & 0 deletions tests/test_printers_roundtrip/ddl/alter_rename.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ ALTER TYPE my.test RENAME TO test2
ALTER VIEW vold RENAME TO zold

ALTER VIEW IF EXISTS vold RENAME TO zold

ALTER OPERATOR FAMILY foo.alt_opf1 USING hash RENAME TO alt_opf2

0 comments on commit 452f998

Please sign in to comment.