Trying to run the following SQL/DDL combination:
SELECT setval('@Value(table_name)_$(Column_Name)_seq', (SELECT (coalesce(max("$(Column_Name)"),0) + 1) FROM "@Value(table_schema)"."@Value(table_name)"));
ALTER TABLE "@Value(table_schema)"."@Value(table_name)" ALTER COLUMN "$(Column_Name)" SET DEFAULT nextval('@Value(table_name)_$(Column_Name)_seq'::regclass);
But the workspace freezes with a deadlock on ALTER TABLE. Tried explicitly BEGINning a transaction before the first statement and COMMITting after the second, but that fails with "transaction already in progress" followed by "no transaction in progress". Not even separating the two statements into different SQLExecutors helps.
Thinking I'm going to need to split this into separate workspaces, or worst case scenario, doing some of it in standalone Python. But wondering if anyone else has run into this and has better suggestions.