Skip to content

Commit

Permalink
cannot cast regclass if relation does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Sep 21, 2024
1 parent 1107ccc commit 897d7fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion postgres-appliance/scripts/post_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ BEGIN
THEN 'FOREIGN TABLE' ELSE 'VIEW'
END INTO obj_type
FROM pg_class
WHERE oid = 'public.postgres_log_${i}'::regclass;
WHERE relname = 'postgres_log_${i}'
AND relnamespace = 'public'::pg_catalog.regnamespace;
EXECUTE format('DROP %s IF EXISTS public.postgres_log_${i} CASCADE', obj_type);
END;\$\$;"

Expand Down
2 changes: 1 addition & 1 deletion postgres-appliance/tests/test_spilo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function verify_hourly_log_rotation() {
postgres_log_views=$(docker_exec "$1" "psql -U postgres -tAc \"SELECT count(*) FROM pg_views WHERE viewname LIKE 'postgres_log_%'\"")
postgres_failed_auth_views=$(docker_exec "$1" "psql -U postgres -tAc \"SELECT count(*) FROM pg_views WHERE viewname LIKE 'failed_authentication_%'\"")

[ "$log_rotation_age" = "1h" ] && [ "$log_filename" = "postgresql-%u-%H.log" ] && [ "$postgres_log_ftables" -eq 192 ] && [ "$postgres_log_views" -eq 8 ] && [ "$postgres_failed_auth_views" -eq 200 ]
[ "$log_rotation_age" -eq "1h" ] && [ "$log_filename" -eq "postgresql-%u-%H.log" ] && [ "$postgres_log_ftables" -eq 192 ] && [ "$postgres_log_views" -eq 8 ] && [ "$postgres_failed_auth_views" -eq 200 ]
}

# TEST SUITE 1 - In-place major upgrade 12->13->...->16
Expand Down

0 comments on commit 897d7fd

Please sign in to comment.