I have a simple powershell script that is supposed to drop an existing schema and restore it from a backup, the script is basically those lines:
echo "Dropping Schema MySchema"
& $PG_SQL -d "host=$DBSERVER port=$DBSERVERPORT dbname=$DATABASE user=$DBSERVERUSER sslmode=require" -c "DROP SCHEMA MySchema CASCADE;"
echo "Restoring MySchema Schema from backup"
& $PG_RESTORE -h $DBSERVER -p $DBSERVERPORT -U $DBSERVERUSER -d $DATABASE -j 6 --no-owner --no-tablespaces --verbose $BACKUP_FILE
When the Schema is empty, it runs through the drop schema command without an issue. When the schema is not empty, it hangs forever after writing "Dropping Schema MySchema". While it hangs there, hitting Enter/Return seems to start it again and the script continues. Problem is that this script is supposed to be run by the CI so it ends up running in a 60min timeout and fails.
Any idea what could be causing such behavior or a different approach to try?