diff options
Diffstat (limited to 'nixpkgs/pkgs/servers/sql/postgresql/patches')
10 files changed, 294 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/disable-normalize_exec_path.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/disable-normalize_exec_path.patch new file mode 100644 index 000000000000..349fd4203348 --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/disable-normalize_exec_path.patch @@ -0,0 +1,12 @@ +--- a/src/common/exec.c ++++ b/src/common/exec.c +@@ -238,6 +238,9 @@ + static int + normalize_exec_path(char *path) + { ++ // On NixOS we *want* stuff relative to symlinks. ++ return 0; ++ + /* + * We used to do a lot of work ourselves here, but now we just let + * realpath(3) do all the heavy lifting. diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/disable-resolve_symlinks.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/disable-resolve_symlinks.patch new file mode 100644 index 000000000000..fadeea90ac4b --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/disable-resolve_symlinks.patch @@ -0,0 +1,12 @@ +--- a/src/common/exec.c 2014-09-04 20:19:12.236057588 +0200 ++++ b/src/common/exec.c 2014-09-04 20:19:50.550251633 +0200 +@@ -218,6 +218,9 @@ + static int + resolve_symlinks(char *path) + { ++ // On NixOS we *want* stuff relative to symlinks. ++ return 0; ++ + #ifdef HAVE_READLINK + struct stat buf; + char orig_wd[MAXPGPATH], diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/findstring.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/findstring.patch new file mode 100644 index 000000000000..959bf6a6caa4 --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/findstring.patch @@ -0,0 +1,59 @@ +From: Matthew Bauer <mjbauer95@gmail.com> +Date: Wed, 29 May 2019 22:51:52 -0400 +Subject: [PATCH] Add /postgresql suffix for Nix outputs + +Nix outputs put the `name' in each store path like +/nix/store/...-<name>. This was confusing the Postgres make script +because it thought its data directory already had postgresql in its +directory. This lead to Postgres installing all of its fils in +$out/share. To fix this, we just look for postgres or psql in the part +after the / using make's notdir. + +--- +From: Matthew Bauer <mjbauer95@gmail.com> +Date: Wed, 29 May 2019 22:51:52 -0400 +Subject: [PATCH] Add /postgresql suffix for Nix outputs + +Nix outputs put the `name' in each store path like +/nix/store/...-<name>. This was confusing the Postgres make script +because it thought its data directory already had postgresql in its +directory. This lead to Postgres installing all of its fils in +$out/share. To fix this, we just look for postgres or psql in the part +after the / using make's notdir. + +--- +diff --git a/src/Makefile.global.in b/src/Makefile.global.in +index b9d86acaa9..bce05464c3 100644 +--- a/src/Makefile.global.in ++++ b/src/Makefile.global.in +@@ -102,15 +102,15 @@ datarootdir := @datarootdir@ + bindir := @bindir@ + + datadir := @datadir@ +-ifeq "$(findstring pgsql, $(datadir))" "" +-ifeq "$(findstring postgres, $(datadir))" "" ++ifeq "$(findstring pgsql, $(notdir $(datadir)))" "" ++ifeq "$(findstring postgres, $(notdir $(datadir)))" "" + override datadir := $(datadir)/postgresql + endif + endif + + sysconfdir := @sysconfdir@ +-ifeq "$(findstring pgsql, $(sysconfdir))" "" +-ifeq "$(findstring postgres, $(sysconfdir))" "" ++ifeq "$(findstring pgsql, $(notdir $(sysconfdir)))" "" ++ifeq "$(findstring postgres, $(notdir $(sysconfdir)))" "" + override sysconfdir := $(sysconfdir)/postgresql + endif + endif +@@ -136,8 +136,8 @@ endif + mandir := @mandir@ + + docdir := @docdir@ +-ifeq "$(findstring pgsql, $(docdir))" "" +-ifeq "$(findstring postgres, $(docdir))" "" ++ifeq "$(findstring pgsql, $(notdir $(docdir)))" "" ++ifeq "$(findstring postgres, $(notdir $(docdir)))" "" + override docdir := $(docdir)/postgresql + endif + endif diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/hardcode-pgxs-path.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/hardcode-pgxs-path.patch new file mode 100644 index 000000000000..6cd449769baa --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/hardcode-pgxs-path.patch @@ -0,0 +1,14 @@ +diff -Naur postgresql-9.6.1-orig/src/common/config_info.c postgresql-9.6.1/src/common/config_info.c +--- postgresql-9.6.1-orig/src/common/config_info.c 2016-11-22 21:39:29.231929261 +0100 ++++ postgresql-9.6.1/src/common/config_info.c 2016-11-22 23:36:53.685163543 +0100 +@@ -118,7 +118,10 @@ + i++; + + configdata[i].name = pstrdup("PGXS"); ++ strlcpy(path, "HARDCODED_PGXS_PATH", sizeof(path)); ++/* commented out to be able to point to nix $out path + get_pkglib_path(my_exec_path, path); ++*/ + strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path)); + cleanup_path(path); + configdata[i].setting = pstrdup(path); diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/less-is-more.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/less-is-more.patch new file mode 100644 index 000000000000..f14af9dc2207 --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/less-is-more.patch @@ -0,0 +1,12 @@ +diff -Naur postgresql-9.6.1-orig/src/include/fe_utils/print.h postgresql-9.6.1/src/include/fe_utils/print.h +--- postgresql-9.6.1-orig/src/include/fe_utils/print.h 2016-11-22 21:39:29.148932827 +0100 ++++ postgresql-9.6.1/src/include/fe_utils/print.h 2016-11-22 21:39:36.283626258 +0100 +@@ -18,7 +18,7 @@ + + /* This is not a particularly great place for this ... */ + #ifndef __CYGWIN__ +-#define DEFAULT_PAGER "more" ++#define DEFAULT_PAGER "less" + #else + #define DEFAULT_PAGER "less" + #endif diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/locale-binary-path.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/locale-binary-path.patch new file mode 100644 index 000000000000..08e90bce750c --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/locale-binary-path.patch @@ -0,0 +1,13 @@ +diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c +index fcfc02d..d011394 100644 +--- a/src/backend/commands/collationcmds.c ++++ b/src/backend/commands/collationcmds.c +@@ -611,7 +611,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS) + aliases = (CollAliasData *) palloc(maxaliases * sizeof(CollAliasData)); + naliases = 0; + +- locale_a_handle = OpenPipeStream("locale -a", "r"); ++ locale_a_handle = OpenPipeStream("@locale@ -a", "r"); + if (locale_a_handle == NULL) + ereport(ERROR, + (errcode_for_file_access(), diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/socketdir-in-run-13.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/socketdir-in-run-13.patch new file mode 100644 index 000000000000..72c778b0758e --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/socketdir-in-run-13.patch @@ -0,0 +1,13 @@ +diff --git i/src/include/pg_config_manual.h w/src/include/pg_config_manual.h +index 8f3ec6bde1..4fc01e4a0a 100644 +--- i/src/include/pg_config_manual.h ++++ w/src/include/pg_config_manual.h +@@ -201,7 +201,7 @@ + * support them yet. + */ + #ifndef WIN32 +-#define DEFAULT_PGSOCKET_DIR "/tmp" ++#define DEFAULT_PGSOCKET_DIR "/run/postgresql" + #else + #define DEFAULT_PGSOCKET_DIR "" + #endif diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/socketdir-in-run.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/socketdir-in-run.patch new file mode 100644 index 000000000000..969f80ff8fc7 --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/socketdir-in-run.patch @@ -0,0 +1,13 @@ +diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h +index 743401cb96..be5c5f61d2 100644 +--- a/src/include/pg_config_manual.h ++++ b/src/include/pg_config_manual.h +@@ -179,7 +179,7 @@ + * here's where to twiddle it. You can also override this at runtime + * with the postmaster's -k switch. + */ +-#define DEFAULT_PGSOCKET_DIR "/tmp" ++#define DEFAULT_PGSOCKET_DIR "/run/postgresql" + + /* + * This is the default event source for Windows event log. diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/specify_pkglibdir_at_runtime.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/specify_pkglibdir_at_runtime.patch new file mode 100644 index 000000000000..fe95d2ee99f0 --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/specify_pkglibdir_at_runtime.patch @@ -0,0 +1,29 @@ +diff -ur postgresql-9.5.3-orig/src/port/path.c postgresql-9.5.3/src/port/path.c +--- postgresql-9.5.3-orig/src/port/path.c 2016-05-09 22:50:23.000000000 +0200 ++++ postgresql-9.5.3/src/port/path.c 2016-08-29 22:44:10.507377613 +0200 +@@ -714,7 +714,11 @@ + void + get_lib_path(const char *my_exec_path, char *ret_path) + { +- make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path); ++ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR"); ++ if(nix_pglibdir == NULL) ++ make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path); ++ else ++ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path); + } + + /* +@@ -723,7 +727,11 @@ + void + get_pkglib_path(const char *my_exec_path, char *ret_path) + { +- make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path); ++ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR"); ++ if(nix_pglibdir == NULL) ++ make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path); ++ else ++ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path); + } + + /* diff --git a/nixpkgs/pkgs/servers/sql/postgresql/patches/stabilize-timetz-dst.patch b/nixpkgs/pkgs/servers/sql/postgresql/patches/stabilize-timetz-dst.patch new file mode 100644 index 000000000000..b6c633cb73eb --- /dev/null +++ b/nixpkgs/pkgs/servers/sql/postgresql/patches/stabilize-timetz-dst.patch @@ -0,0 +1,117 @@ +From 4a071afbd056282746a5bc9362e87f579a56402d Mon Sep 17 00:00:00 2001 +From: Tom Lane <tgl@sss.pgh.pa.us> +Date: Thu, 29 Oct 2020 15:28:14 -0400 +Subject: [PATCH 1/1] Stabilize timetz test across DST transitions. + +The timetz test cases I added in commit a9632830b were unintentionally +sensitive to whether or not DST is active in the PST8PDT time zone. +Thus, they'll start failing this coming weekend, as reported by +Bernhard M. Wiedemann in bug #16689. Fortunately, DST-awareness is +not significant to the purpose of these test cases, so we can just +force them all to PDT (DST hours) to preserve stability of the +results. + +Back-patch to v10, as the prior patch was. + +Discussion: https://postgr.es/m/16689-57701daa23b377bf@postgresql.org +Git viewer: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=4a071afbd056282746a5bc9362e87f579a56402d;hp=f90149e6285aaae6b48559afce1bd638ee26c33e +--- + src/test/regress/expected/timetz.out | 32 ++++++++++++++-------------- + src/test/regress/sql/timetz.sql | 16 +++++++------- + 2 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/src/test/regress/expected/timetz.out b/src/test/regress/expected/timetz.out +index 038bb5fa09..1ab5ed5105 100644 +--- a/src/test/regress/expected/timetz.out ++++ b/src/test/regress/expected/timetz.out +@@ -91,45 +91,45 @@ SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; + (12 rows) + + -- Check edge cases +-SELECT '23:59:59.999999'::timetz; ++SELECT '23:59:59.999999 PDT'::timetz; + timetz + -------------------- + 23:59:59.999999-07 + (1 row) + +-SELECT '23:59:59.9999999'::timetz; -- rounds up ++SELECT '23:59:59.9999999 PDT'::timetz; -- rounds up + timetz + ------------- + 24:00:00-07 + (1 row) + +-SELECT '23:59:60'::timetz; -- rounds up ++SELECT '23:59:60 PDT'::timetz; -- rounds up + timetz + ------------- + 24:00:00-07 + (1 row) + +-SELECT '24:00:00'::timetz; -- allowed ++SELECT '24:00:00 PDT'::timetz; -- allowed + timetz + ------------- + 24:00:00-07 + (1 row) + +-SELECT '24:00:00.01'::timetz; -- not allowed +-ERROR: date/time field value out of range: "24:00:00.01" +-LINE 1: SELECT '24:00:00.01'::timetz; ++SELECT '24:00:00.01 PDT'::timetz; -- not allowed ++ERROR: date/time field value out of range: "24:00:00.01 PDT" ++LINE 1: SELECT '24:00:00.01 PDT'::timetz; + ^ +-SELECT '23:59:60.01'::timetz; -- not allowed +-ERROR: date/time field value out of range: "23:59:60.01" +-LINE 1: SELECT '23:59:60.01'::timetz; ++SELECT '23:59:60.01 PDT'::timetz; -- not allowed ++ERROR: date/time field value out of range: "23:59:60.01 PDT" ++LINE 1: SELECT '23:59:60.01 PDT'::timetz; + ^ +-SELECT '24:01:00'::timetz; -- not allowed +-ERROR: date/time field value out of range: "24:01:00" +-LINE 1: SELECT '24:01:00'::timetz; ++SELECT '24:01:00 PDT'::timetz; -- not allowed ++ERROR: date/time field value out of range: "24:01:00 PDT" ++LINE 1: SELECT '24:01:00 PDT'::timetz; + ^ +-SELECT '25:00:00'::timetz; -- not allowed +-ERROR: date/time field value out of range: "25:00:00" +-LINE 1: SELECT '25:00:00'::timetz; ++SELECT '25:00:00 PDT'::timetz; -- not allowed ++ERROR: date/time field value out of range: "25:00:00 PDT" ++LINE 1: SELECT '25:00:00 PDT'::timetz; + ^ + -- + -- TIME simple math +diff --git a/src/test/regress/sql/timetz.sql b/src/test/regress/sql/timetz.sql +index b699e4b03c..ce763d89e8 100644 +--- a/src/test/regress/sql/timetz.sql ++++ b/src/test/regress/sql/timetz.sql +@@ -36,14 +36,14 @@ SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07'; + SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; + + -- Check edge cases +-SELECT '23:59:59.999999'::timetz; +-SELECT '23:59:59.9999999'::timetz; -- rounds up +-SELECT '23:59:60'::timetz; -- rounds up +-SELECT '24:00:00'::timetz; -- allowed +-SELECT '24:00:00.01'::timetz; -- not allowed +-SELECT '23:59:60.01'::timetz; -- not allowed +-SELECT '24:01:00'::timetz; -- not allowed +-SELECT '25:00:00'::timetz; -- not allowed ++SELECT '23:59:59.999999 PDT'::timetz; ++SELECT '23:59:59.9999999 PDT'::timetz; -- rounds up ++SELECT '23:59:60 PDT'::timetz; -- rounds up ++SELECT '24:00:00 PDT'::timetz; -- allowed ++SELECT '24:00:00.01 PDT'::timetz; -- not allowed ++SELECT '23:59:60.01 PDT'::timetz; -- not allowed ++SELECT '24:01:00 PDT'::timetz; -- not allowed ++SELECT '25:00:00 PDT'::timetz; -- not allowed + + -- + -- TIME simple math +-- +2.20.1 |