admin管理员组文章数量:1317906
I am automating a database reload as part of a test script. To my dismay, pg_restore.exe appears to only return $null. Even when deliberately mangling the file name, I get a $null back (although it prints a message to the screen). However a screen print doesn't do the script any good.
The line in the PowerShell script, which works, other than a complete lack of feedback...
$PGResult = &"C:\Program Files\PostgreSQL\16\bin\pg_restore.exe" --clean --dbname=postgresql://:@localhost:/<target_database> $DB_Filename
The $DB_Filename changes per run but the rest of the <> tags are a fixed part of the script.
Any idea how to get some kind of return code from pg_restore.exe so that the script knows if the database was successfully restored or not?
本文标签:
版权声明:本文标题:postgresql - PostgreSQL16 : using pg_restore in a PowerShell script, but it only ever returns $null - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741999082a2410641.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论