1
0
Fork 0

fix psycopg.sql.Identifier in \ev handling (#1384)

This commit is contained in:
Andy Schoenberger 2022-11-21 19:10:13 -05:00 committed by GitHub
parent d6ca4c3464
commit 2db54f14aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ Features:
Also prevents getting stuck in a retry loop.
* Config option to not restart connection when cancelling a `destructive_warning` query. By default,
it will now not restart.
* Fix \ev not producing a correctly quoted "schema"."view"
3.5.0 (2022/09/15):
===================

View File

@ -470,7 +470,7 @@ class PGExecute:
return (
psycopg.sql.SQL(template)
.format(
name=psycopg.sql.Identifier(f"{result.nspname}.{result.relname}"),
name=psycopg.sql.Identifier(result.nspname, result.relname),
stmt=psycopg.sql.SQL(result.viewdef),
)
.as_string(self.conn)

View File

@ -558,6 +558,7 @@ def test_view_definition(executor):
run(executor, "create view vw1 AS SELECT * FROM tbl1")
run(executor, "create materialized view mvw1 AS SELECT * FROM tbl1")
result = executor.view_definition("vw1")
assert 'VIEW "public"."vw1" AS' in result
assert "FROM tbl1" in result
# import pytest; pytest.set_trace()
result = executor.view_definition("mvw1")