Skip to content

Commit fb0694b

Browse files
committed
chore: special handling for oriole
1 parent f2a47af commit fb0694b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

nix/ext/wrappers/default.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@ buildPgrxExtension_0_12_9 rec {
4343
POSTGRES_LIB = "${postgresql}/lib";
4444
RUSTFLAGS = "-C link-arg=-undefined -C link-arg=dynamic_lookup";
4545
# Calculate unique port for each PostgreSQL version:
46-
# - Take first 2 chars of version (e.g., "15" from "15.8", "17" from "17.0")
47-
# - Convert to number and subtract 15 to get offset
48-
# - Add to base port 5435
46+
# - Check if version contains underscore (indicating OrioleDB)
47+
# - Add 1 to port if it's OrioleDB
48+
# - Add 2 for each major version above 15
4949
# Examples:
50-
# - PostgreSQL 15.8 → 5435 + (15-15) = 5435
51-
# - PostgreSQL 17.0 → 5435 + (17-15) = 5437
52-
# - PostgreSQL 17.4 → 5435 + (17-15) = 5437
53-
PGPORT = toString (5435 + (builtins.fromJSON (builtins.substring 0 2 postgresql.version)) - 15);
50+
# - PostgreSQL 15.8 → 5435 + 0 + (15-15)*2 = 5435
51+
# - PostgreSQL 17_0 (OrioleDB) → 5435 + 1 + (17-15)*2 = 5440
52+
# - PostgreSQL 17.4 → 5435 + 0 + (17-15)*2 = 5439
53+
PGPORT = toString (5435 +
54+
(if builtins.match ".*_.*" postgresql.version != null then 1 else 0) + # +1 for OrioleDB
55+
((builtins.fromJSON (builtins.substring 0 2 postgresql.version)) - 15) * 2); # +2 for each major version
5456
};
5557

5658
OPENSSL_NO_VENDOR = 1;

0 commit comments

Comments
 (0)