|
241 | 241 | fi |
242 | 242 | done |
243 | 243 | 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 |
244 | 273 | '' |
245 | 274 | + lib.optionalString jitSupport '' |
246 | 275 | # Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that |
|
0 commit comments