mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
fixup! fixup! fixup! [IMP] use sqlparse also to determine which ddl to update
This commit is contained in:
@@ -35,6 +35,12 @@ def schema_qualify(parsed_query, schema="public"):
|
|||||||
# this is invalid sql
|
# this is invalid sql
|
||||||
next_token = False
|
next_token = False
|
||||||
break
|
break
|
||||||
|
if next_token.is_keyword and next_token.normalized in (
|
||||||
|
'TEMP', 'TEMPORARY'
|
||||||
|
):
|
||||||
|
# don't qualify CREATE TEMP TABLE statements
|
||||||
|
is_qualified = True
|
||||||
|
break
|
||||||
if not (next_token.is_whitespace or next_token.is_keyword):
|
if not (next_token.is_whitespace or next_token.is_keyword):
|
||||||
break
|
break
|
||||||
yield next_token
|
yield next_token
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ class TestPglogical(TransactionCase):
|
|||||||
'drop table',
|
'drop table',
|
||||||
"alter table 'test'",
|
"alter table 'test'",
|
||||||
'ALTER TABLE "testtable" ADD COLUMN "test_field" double precision',
|
'ALTER TABLE "testtable" ADD COLUMN "test_field" double precision',
|
||||||
|
'CREATE TEMP TABLE "temptable" (col1 char)',
|
||||||
):
|
):
|
||||||
qualified_query = ''.join(
|
qualified_query = ''.join(
|
||||||
''.join(str(token) for token in schema_qualify(parsed_query))
|
''.join(str(token) for token in schema_qualify(parsed_query))
|
||||||
|
|||||||
Reference in New Issue
Block a user