Skip to content

Commit

Permalink
Adding more unusual tablespaces names per @andreasscherbaum
Browse files Browse the repository at this point in the history
  • Loading branch information
za-arthur committed Mar 11, 2024
1 parent d6912c9 commit 9a96bfa
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 8 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions regress/create_tablespaces.sh
Original file line number Diff line number Diff line change
@@ -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'"
30 changes: 30 additions & 0 deletions regress/expected/tablespace.out
Original file line number Diff line number Diff line change
Expand Up @@ -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)

30 changes: 30 additions & 0 deletions regress/expected/tablespace_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -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)

30 changes: 30 additions & 0 deletions regress/expected/tablespace_2.out
Original file line number Diff line number Diff line change
Expand Up @@ -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)

30 changes: 30 additions & 0 deletions regress/expected/tablespace_3.out
Original file line number Diff line number Diff line change
Expand Up @@ -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)

30 changes: 30 additions & 0 deletions regress/expected/tablespace_4.out
Original file line number Diff line number Diff line change
Expand Up @@ -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)

16 changes: 16 additions & 0 deletions regress/sql/tablespace.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 9a96bfa

Please sign in to comment.