Skip to content

Commit 862a634

Browse files
committed
feature: testing the creation of auth_trgm to give auth own version
of pg_trgm
1 parent 60fbae0 commit 862a634

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ postgres_major:
1010

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.6.0.010-orioledb"
14-
postgres17: "17.6.1.053"
15-
postgres15: "15.14.1.053"
13+
postgresorioledb-17: "17.6.0.010-orioledb-auth-trgm-1"
14+
postgres17: "17.6.1.053-auth-trgm-1"
15+
postgres15: "15.14.1.053-auth-trgm-1"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.19.0

nix/postgresql/generic.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,35 @@ let
241241
fi
242242
done
243243
fi
244+
245+
# Create auth_trgm extension as a duplicate of pg_trgm
246+
# auth_trgm uses the same shared library but has separate SQL files
247+
echo "Creating auth_trgm extension files..."
248+
249+
# Copy and rewrite all pg_trgm SQL files (base + upgrade paths)
250+
for file in $out/share/postgresql/extension/pg_trgm*.sql; do
251+
if [ -f "$file" ]; then
252+
base=$(basename "$file")
253+
newfile="$out/share/postgresql/extension/''${base//pg_trgm/auth_trgm}"
254+
# Replace pg_trgm with auth_trgm in extension references
255+
# but preserve the actual function names and module references
256+
sed 's/-- complain if script is sourced in psql, rather than via CREATE EXTENSION/-- complain if script is sourced in psql, rather than via CREATE EXTENSION/; s/\\echo Use "CREATE EXTENSION pg_trgm"/\\echo Use "CREATE EXTENSION auth_trgm"/' "$file" > "$newfile"
257+
fi
258+
done
259+
260+
# Create auth_trgm.control pointing to the same shared library as pg_trgm
261+
if [ -f "$out/share/postgresql/extension/pg_trgm.control" ]; then
262+
sed -e 's/# pg_trgm extension/# auth_trgm extension/' \
263+
-e 's/text similarity measurement and index searching based on trigrams/authentication text similarity measurement and index searching based on trigrams/' \
264+
-e 's/relocatable = true/relocatable = false/' \
265+
"$out/share/postgresql/extension/pg_trgm.control" > \
266+
"$out/share/postgresql/extension/auth_trgm.control"
267+
268+
# Append schema = auth to the control file
269+
echo "schema = auth" >> "$out/share/postgresql/extension/auth_trgm.control"
270+
271+
echo "auth_trgm extension files created successfully"
272+
fi
244273
''
245274
+ lib.optionalString jitSupport ''
246275
# Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that

0 commit comments

Comments
 (0)