Skip to content

Commit 0dfeaae

Browse files
authored
Sam/postgis tiger fix (#1413)
* chore: wip attempt to fix search paths for postgis_tiger_geocoder * chore: suffix for staging AMI * chore: newline * chore: fix pg_regress * fix: use postgis_extension_AddToSearchPath for extensions schema * chore: bump staging suffix * chore: resolve quotes to test * chore: bump versions
1 parent 66fb5c1 commit 0dfeaae

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

ansible/vars.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ postgres_major:
88

99
# Full version strings for each major version
1010
postgres_release:
11-
postgresorioledb-17: "17.0.1.020-orioledb"
12-
postgres15: "15.8.1.030"
11+
postgresorioledb-17: "17.0.1.021-orioledb"
12+
postgres15: "15.8.1.031"
1313

1414
# Non Postgres Extensions
1515
pgbouncer_release: "1.19.0"

nix/ext/postgis.nix

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ stdenv.mkDerivation rec {
3535
nativeBuildInputs = [ perl pkg-config ];
3636
dontDisableStatic = true;
3737

38-
# postgis config directory assumes /include /lib from the same root for json-c library
39-
env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
4038

39+
env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
4140

4241
preConfigure = ''
4342
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
4443
configureFlags="--datadir=$out/share/postgresql --datarootdir=$out/share/postgresql --bindir=$out/bin --docdir=$doc/share/doc/${pname} --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev} --disable-extension-upgrades-install --with-sfcgal"
4544
4645
makeFlags="PERL=${perl}/bin/perl datadir=$out/share/postgresql pkglibdir=$out/lib bindir=$out/bin docdir=$doc/share/doc/${pname}"
4746
'';
47+
4848
postConfigure = ''
4949
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
5050
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
@@ -54,28 +54,25 @@ stdenv.mkDerivation rec {
5454
" \
5555
"raster/scripts/python/Makefile";
5656
mkdir -p $out/bin
57-
58-
# postgis' build system assumes it is being installed to the same place as postgresql, and looks
59-
# for the postgres binary relative to $PREFIX. We gently support this system using an illusion.
6057
ln -s ${postgresql}/bin/postgres $out/bin/postgres
6158
'';
6259

63-
# create aliases for all commands adding version information
64-
postInstall = ''
65-
# Teardown the illusory postgres used for building; see postConfigure.
66-
rm $out/bin/postgres
67-
68-
for prog in $out/bin/*; do # */
69-
ln -s $prog $prog-${version}
70-
done
71-
72-
for file in $out/share/postgresql/extension/postgis_topology*--${version}.sql; do
73-
sed -i "/SELECT topology.AddToSearchPath('topology');/i SELECT topology.AddToSearchPath('extensions');" "$file"
74-
done
75-
76-
mkdir -p $doc/share/doc/postgis
77-
mv doc/* $doc/share/doc/postgis/
78-
'';
60+
postInstall = ''
61+
rm $out/bin/postgres
62+
for prog in $out/bin/*; do # */
63+
ln -s $prog $prog-${version}
64+
done
65+
# Add function definition and usage to tiger geocoder files
66+
for file in $out/share/postgresql/extension/postgis_tiger_geocoder*--${version}.sql; do
67+
sed -i "/SELECT postgis_extension_AddToSearchPath('tiger');/a SELECT postgis_extension_AddToSearchPath('extensions');" "$file"
68+
done
69+
# Original topology patching
70+
for file in $out/share/postgresql/extension/postgis_topology*--${version}.sql; do
71+
sed -i "/SELECT topology.AddToSearchPath('topology');/i SELECT topology.AddToSearchPath('extensions');" "$file"
72+
done
73+
mkdir -p $doc/share/doc/postgis
74+
mv doc/* $doc/share/doc/postgis/
75+
'';
7976

8077
passthru.tests.postgis = nixosTests.postgis;
8178

0 commit comments

Comments
 (0)