timescaledb/scripts/test_functions.inc
Mats Kindahl aeb107659b Copy recreated object permissions on update
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
2021-04-26 08:36:57 +02:00

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
)