修正备份演练表行数统计

This commit is contained in:
yml2213
2026-08-23 15:08:47 +08:00
parent ad59066637
commit 8f3a5c6a67
+1 -1
View File
@@ -316,7 +316,7 @@ verify_backup() {
log "各表行数:"
docker exec "${cid}" psql -U postgres -d order_site -At -F '=' \
-c "SELECT tablename, (xpath('/row/count/text()', query_to_xml(format('SELECT count(*) AS count FROM %I.%I', schemaname, tablename), true, false, '')))[1]::text::bigint FROM pg_tables WHERE schemaname = 'public' ORDER BY tablename"
-c "SELECT tablename, (xpath('/table/row/count/text()', query_to_xml(format('SELECT count(*) AS count FROM %I.%I', schemaname, tablename), true, false, '')))[1]::text::bigint FROM pg_tables WHERE schemaname = 'public' ORDER BY tablename"
log "验证通过,已清理临时容器。建议每月执行一次。"
docker rm -f -v "${VERIFY_CONTAINER}" >/dev/null 2>&1 || true