pg-clone-schema
pg-clone-schema copied to clipboard
Owner with special characters
Issue: Cloning a schema from an owner with special characters causes the clone_schema to fail.
Description: Some statements are executed without quotation marks around the owner.
I quoted the owner at different positions. See diff files for changes that worked for me. diff_clone_schema.sql.txt
Steps to reproduce
-
Have a database that belongs to an owner with special characters e.g. "tu-user". Schema, tables, ... belong to that same owner.
-
Execute the original code snippet.
-
Observe the error due to unescaped special characters.
Diagnostics: line=PL/pgSQL function clone_schema(text,text,cloneparms[]) line 312 at EXECUTE. 42601. syntax error at or near "-"
Proposed change: Add double quotes around the owner in all statements.
Benefits: This change will prevent errors caused by special characters in the owner name.
Thanks a lot!