mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-15 01:53:41 +08:00
Tables, indexes, and sequences that are recreated as part of an update does not propagate permissions to the recreated object. This commit fixes that by saving away the permissions in `pg_class` temporarily and then copying them back into the `pg_class` table. If internal objects are created or re-created, they get the wrong initial privileges, which result in privileges not being dumped when using `pg_dump`. Save away the privileges before starting the update and restore them afterwards to make sure that the privileges are maintained over the update. For new objects, we use the initial privileges of the `chunk` metadata table, which should always have correct initial privileges. Fixes #3078
45 lines
875 B
Bash
45 lines
875 B
Bash
#!/usr/bin/env bash
|
|
|
|
SCRIPT_DIR=$(dirname $0)
|
|
|
|
# Run tests given as arguments.
|
|
#
|
|
# Options:
|
|
# -r Run repair tests as a separate pass (optional)
|
|
# -k Keep temporary directory
|
|
# -vN Use version N of the update tests (required)
|
|
run_tests() (
|
|
export TEST_VERSION
|
|
export TEST_REPAIR=false
|
|
export DO_CLEANUP=true
|
|
|
|
OPTIND=1
|
|
while getopts "kv:r" opt;
|
|
do
|
|
case $opt in
|
|
v)
|
|
TEST_VERSION=v$OPTARG
|
|
;;
|
|
k)
|
|
DO_CLEANUP=false
|
|
;;
|
|
r)
|
|
TEST_REPAIR=true
|
|
;;
|
|
esac
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
export TAGS="$@"
|
|
bash ${SCRIPT_DIR}/test_updates.sh
|
|
if [[ "$TEST_REPAIR" = "true" ]]; then
|
|
bash ${SCRIPT_DIR}/test_repairs.sh
|
|
fi
|
|
EXIT_CODE=$?
|
|
if [ $EXIT_CODE -ne 0 ]; then
|
|
exit $EXIT_CODE
|
|
fi
|
|
)
|
|
|