From 9a96bfad01784aa3535b2c754b712be2b82ffc87 Mon Sep 17 00:00:00 2001 From: Artur Zakirov Date: Mon, 11 Mar 2024 16:41:48 +0100 Subject: [PATCH] Adding more unusual tablespaces names per @andreasscherbaum --- .github/workflows/regression.yml | 10 ++-------- regress/create_tablespaces.sh | 8 ++++++++ regress/expected/tablespace.out | 30 ++++++++++++++++++++++++++++++ regress/expected/tablespace_1.out | 30 ++++++++++++++++++++++++++++++ regress/expected/tablespace_2.out | 30 ++++++++++++++++++++++++++++++ regress/expected/tablespace_3.out | 30 ++++++++++++++++++++++++++++++ regress/expected/tablespace_4.out | 30 ++++++++++++++++++++++++++++++ regress/sql/tablespace.sql | 16 ++++++++++++++++ 8 files changed, 176 insertions(+), 8 deletions(-) create mode 100755 regress/create_tablespaces.sh diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 467efaf..5fb6254 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -34,14 +34,8 @@ jobs: - name: Put pg_repack on PATH run: echo "$PWD/bin" >> $GITHUB_PATH - - name: Create testts directory - run: sudo -u postgres mkdir /tmp/testts /tmp/1testts - - - name: Create testts tablespace - run: sudo -u postgres psql -c "CREATE TABLESPACE testts LOCATION '/tmp/testts'" - - - name: Create 1testts tablespace - run: sudo -u postgres psql -c "CREATE TABLESPACE \"1testts\" LOCATION '/tmp/1testts'" + - name: Create tablespaces + run: bash regress/create_tablespaces.sh - name: Test on PostgreSQL ${{ matrix.pg }} run: pg-build-test diff --git a/regress/create_tablespaces.sh b/regress/create_tablespaces.sh new file mode 100755 index 0000000..e9e64e3 --- /dev/null +++ b/regress/create_tablespaces.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +sudo -u postgres mkdir /tmp/testts /tmp/1testts /tmp/test\ ts /tmp/test\"ts + +sudo -u postgres psql -c "CREATE TABLESPACE testts LOCATION '/tmp/testts'" +sudo -u postgres psql -c "CREATE TABLESPACE \"1testts\" LOCATION '/tmp/1testts'" +sudo -u postgres psql -c "CREATE TABLESPACE \"test ts\" LOCATION '/tmp/test ts'" +sudo -u postgres psql -c "CREATE TABLESPACE \"test\"\"ts\" LOCATION '/tmp/test\"ts'" diff --git a/regress/expected/tablespace.out b/regress/expected/tablespace.out index 819dcfe..164c6f3 100644 --- a/regress/expected/tablespace.out +++ b/regress/expected/tablespace.out @@ -260,3 +260,33 @@ ORDER BY relname; testts1_with_idx | 1testts (4 rows) +--check quote_ident() with "test ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test ts + testts1_partial_idx | test ts + testts1_pkey | test ts + testts1_with_idx | test ts +(4 rows) + +--check quote_ident() with "test""ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test\"ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test"ts + testts1_partial_idx | test"ts + testts1_pkey | test"ts + testts1_with_idx | test"ts +(4 rows) + diff --git a/regress/expected/tablespace_1.out b/regress/expected/tablespace_1.out index 177505e..007dac4 100644 --- a/regress/expected/tablespace_1.out +++ b/regress/expected/tablespace_1.out @@ -260,3 +260,33 @@ ORDER BY relname; testts1_with_idx | 1testts (4 rows) +--check quote_ident() with "test ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test ts + testts1_partial_idx | test ts + testts1_pkey | test ts + testts1_with_idx | test ts +(4 rows) + +--check quote_ident() with "test""ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test\"ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test"ts + testts1_partial_idx | test"ts + testts1_pkey | test"ts + testts1_with_idx | test"ts +(4 rows) + diff --git a/regress/expected/tablespace_2.out b/regress/expected/tablespace_2.out index e06c371..f5a56a7 100644 --- a/regress/expected/tablespace_2.out +++ b/regress/expected/tablespace_2.out @@ -260,3 +260,33 @@ ORDER BY relname; testts1_with_idx | 1testts (4 rows) +--check quote_ident() with "test ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test ts + testts1_partial_idx | test ts + testts1_pkey | test ts + testts1_with_idx | test ts +(4 rows) + +--check quote_ident() with "test""ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test\"ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test"ts + testts1_partial_idx | test"ts + testts1_pkey | test"ts + testts1_with_idx | test"ts +(4 rows) + diff --git a/regress/expected/tablespace_3.out b/regress/expected/tablespace_3.out index 6a898d3..4ff1bc4 100644 --- a/regress/expected/tablespace_3.out +++ b/regress/expected/tablespace_3.out @@ -260,3 +260,33 @@ ORDER BY relname; testts1_with_idx | 1testts (4 rows) +--check quote_ident() with "test ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test ts + testts1_partial_idx | test ts + testts1_pkey | test ts + testts1_with_idx | test ts +(4 rows) + +--check quote_ident() with "test""ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test\"ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test"ts + testts1_partial_idx | test"ts + testts1_pkey | test"ts + testts1_with_idx | test"ts +(4 rows) + diff --git a/regress/expected/tablespace_4.out b/regress/expected/tablespace_4.out index ddcec3b..d997029 100644 --- a/regress/expected/tablespace_4.out +++ b/regress/expected/tablespace_4.out @@ -260,3 +260,33 @@ ORDER BY relname; testts1_with_idx | 1testts (4 rows) +--check quote_ident() with "test ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test ts + testts1_partial_idx | test ts + testts1_pkey | test ts + testts1_with_idx | test ts +(4 rows) + +--check quote_ident() with "test""ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test\"ts" --moveidx +INFO: repacking table "public.testts1" +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + relname | spcname +---------------------+--------- + testts1 | test"ts + testts1_partial_idx | test"ts + testts1_pkey | test"ts + testts1_with_idx | test"ts +(4 rows) + diff --git a/regress/sql/tablespace.sql b/regress/sql/tablespace.sql index 52a1b4d..8f770fd 100644 --- a/regress/sql/tablespace.sql +++ b/regress/sql/tablespace.sql @@ -155,3 +155,19 @@ SELECT relname, spcname FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace WHERE relname ~ '^testts1' ORDER BY relname; + +--check quote_ident() with "test ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test ts" --moveidx + +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname; + +--check quote_ident() with "test""ts" tablespace +\! pg_repack --dbname=contrib_regression --table=testts1 --tablespace="test\"ts" --moveidx + +SELECT relname, spcname +FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace +WHERE relname ~ '^testts1' +ORDER BY relname;