summaryrefslogtreecommitdiff
path: root/libpq/libpq
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-11-30 22:37:25 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-12-06 15:11:04 +0300
commitf1f39911e0d2d88c98eae96a3eb14a53c664206f (patch)
tree4cf4e3a84d895f59323d3b6ab4bfab38b3cab489 /libpq/libpq
parentfc9499b8a7b7a3e350bfabf2cd6ae0bc13f04bea (diff)
Upgrade to 12.1
Diffstat (limited to 'libpq/libpq')
-rw-r--r--libpq/libpq/.gitignore3
-rw-r--r--libpq/libpq/buildfile233
l---------libpq/libpq/common/base64.c1
l---------libpq/libpq/common/ip.c1
l---------libpq/libpq/common/link-canary.c1
l---------libpq/libpq/common/md5.c1
l---------libpq/libpq/common/saslprep.c1
l---------libpq/libpq/common/scram-common.c1
l---------libpq/libpq/common/sha2_openssl.c1
l---------libpq/libpq/common/unicode_norm.c1
l---------libpq/libpq/include/c.h1
l---------libpq/libpq/include/common1
l---------libpq/libpq/include/getaddrinfo.h1
l---------libpq/libpq/include/libpq/libpq-fs.h1
l---------libpq/libpq/include/libpq/pqcomm.h1
l---------libpq/libpq/include/mb/pg_wchar.h1
l---------libpq/libpq/include/pg_config_manual.h1
l---------libpq/libpq/include/port.h1
l---------libpq/libpq/include/port/darwin.h1
l---------libpq/libpq/include/port/freebsd.h1
l---------libpq/libpq/include/port/linux.h1
l---------libpq/libpq/include/port/pg_bswap.h1
l---------libpq/libpq/include/port/win321
l---------libpq/libpq/include/port/win32.h1
l---------libpq/libpq/include/port/win32_msvc1
l---------libpq/libpq/include/port/win32_port.h1
l---------libpq/libpq/include/postgres_ext.h1
l---------libpq/libpq/include/postgres_fe.h1
-rw-r--r--libpq/libpq/libpqdll.def178
-rw-r--r--libpq/libpq/libpqdll.map178
l---------libpq/libpq/mb/encnames.c1
l---------libpq/libpq/mb/wchar.c1
-rw-r--r--libpq/libpq/pg_config.h369
l---------libpq/libpq/pg_config.h.in.orig1
l---------libpq/libpq/pg_config.h.win32.orig1
-rw-r--r--libpq/libpq/pg_config_ext.h19
l---------libpq/libpq/pg_config_ext.h.in.orig1
l---------libpq/libpq/pg_config_ext.h.win32.orig1
-rw-r--r--libpq/libpq/pg_config_os.h21
-rw-r--r--libpq/libpq/pg_config_paths.h11
l---------libpq/libpq/port/chklocale.c1
l---------libpq/libpq/port/getaddrinfo.c1
l---------libpq/libpq/port/getpeereid.c1
l---------libpq/libpq/port/inet_aton.c1
l---------libpq/libpq/port/inet_net_ntop.c1
l---------libpq/libpq/port/noblock.c1
l---------libpq/libpq/port/open.c1
l---------libpq/libpq/port/pg_strong_random.c1
l---------libpq/libpq/port/pgsleep.c1
l---------libpq/libpq/port/pgstrcasecmp.c1
l---------libpq/libpq/port/pthread-win32.h1
l---------libpq/libpq/port/snprintf.c1
l---------libpq/libpq/port/strerror.c1
l---------libpq/libpq/port/strlcpy.c1
l---------libpq/libpq/port/system.c1
l---------libpq/libpq/port/thread.c1
l---------libpq/libpq/port/win32error.c1
l---------libpq/libpq/port/win32setlocale.c1
l---------libpq/libpq/pq1
-rw-r--r--libpq/libpq/version.h.in17
60 files changed, 1080 insertions, 0 deletions
diff --git a/libpq/libpq/.gitignore b/libpq/libpq/.gitignore
new file mode 100644
index 0000000..620b4c8
--- /dev/null
+++ b/libpq/libpq/.gitignore
@@ -0,0 +1,3 @@
+# Generated version.h.
+#
+version.h
diff --git a/libpq/libpq/buildfile b/libpq/libpq/buildfile
new file mode 100644
index 0000000..d77ccf7
--- /dev/null
+++ b/libpq/libpq/buildfile
@@ -0,0 +1,233 @@
+# file : libpq/buildfile
+# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+# license : PostgreSQL Licenes; see accompanying COPYRIGHT file
+
+import imp_libs = libssl%lib{ssl}
+import imp_libs += libcrypto%lib{crypto}
+
+# Exclude source code of unused features (authentication methods, etc).
+#
+# @@ When it becomes possible (probably with ad hoc rules), generate
+# libpqdll.map and libpqdll.def on the fly from pq/exports.txt applying
+# regex replace to its lines and adding prologue/epilogue.
+#
+lib{pq}: {h }{* -version} \
+ {h }{ version} \
+ pq/{h c}{* -fe-gssapi-common -fe-secure-gssapi -*win32*} \
+ mb/{ c}{* } \
+ port/{h c}{* -strlcpy -getaddrinfo -inet_aton -*win32*} \
+ common/{ c}{* } \
+ include/{h }{** } \
+ {def }{libpqdll } \
+ {file}{libpqdll.map } \
+ pq/{file}{pg_service.conf.sample } \
+ $imp_libs
+
+tclass = $c.target.class
+tsys = $c.target.system
+
+bsd = ($tclass == 'bsd')
+macos = ($tclass == 'macos')
+windows = ($tclass == 'windows')
+
+lib{pq}: port/c{strlcpy}: include = (!$bsd && !$macos)
+
+lib{pq}: pq/{h c}{*win32* } \
+ port/{h c}{*win32* +getaddrinfo +inet_aton}: include = $windows
+
+# The version file is an internal one (it is only included from pg_config.h)
+# so we don't distribute nor install it (see below).
+#
+h{version}: in{version} $src_root/manifest
+
+# Build options.
+#
+# Note that the upstream package also defines a bunch of the VAL_* macros
+# (VAL_CONFIGURE, VAL_CC, etc) that are used in get_configdata(), if defined.
+# We will omit them for the sake of simplicity.
+#
+c.poptions += -DFRONTEND -DUNSAFE_STAT_OK -DSO_MAJOR_VERSION=$abi_major
+
+if! $windows
+ # Note that the upstream package uses -pthread compiler/linker option. It is
+ # currently unsupported by build2, so we use -D_REENTRANT and -lpthread
+ # preprocessor/linker options instead. We also omit -D_THREAD_SAFE (synonym
+ # for -D_REENTRANT) and Solaris-specific -D_POSIX_PTHREAD_SEMANTICS.
+ #
+ c.poptions += -D_REENTRANT
+else
+ # Note that the upstream package defines the WIN32 macro for VC only,
+ # relying on the fact that MinGW GCC defines it by default. However, the
+ # macro disappears from the default ones if to compile with -std=c9x (as we
+ # do). So we define it for both VC and MinGW GCC.
+ #
+ # It's tempting to move this definition to libpq/pg_config.h. However this
+ # header is not included into all files that use the macro, for example,
+ # libpq/port/open.c.
+ #
+ c.poptions += -DWIN32
+
+# Note that we need to add "-I$src_root" for the headers auto-generating
+# machinery to work properly.
+#
+c.poptions =+ "-I$out_root" "-I$src_root" "-I$src_base" "-I$src_base/port" \
+ "-I$src_base/pq" "-I$src_base/include"
+
+switch $tclass, $tsys
+{
+ case 'linux'
+ c.poptions += -D_GNU_SOURCE
+
+ case 'windows', 'mingw32'
+ {
+ c.poptions += -DBUILDING_DLL -DEXEC_BACKEND
+ c.poptions =+ "-I$src_base/include/port/win32"
+ }
+ case 'windows'
+ {
+ # Probably some of the *WIN* macro definitions are not really required,
+ # but let's keep all of them for good measure.
+ #
+ c.poptions += -DEXEC_BACKEND -D_WINDLL -D__WINDOWS__ -D__WIN32__ -D_MBCS \
+ -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
+
+ c.poptions =+ "-I$src_base/include/port/win32_msvc" \
+ "-I$src_base/include/port/win32"
+ }
+}
+
+# Define SYSCONFDIR macro. This path is used as a last resort for the
+# pg_service.conf file search (see pq/fe-connect.c for details).
+#
+# The whole idea feels utterly broken (hello cross-compilation) so we will
+# just do bare minimum and wait and see.
+#
+# @@ We should probably allow to configure this macros via configuration
+# variable config.libpq.sysconfdir.
+#
+# For the upstream package if the resulted sysconfdir path doesn't contain the
+# 'postgres' or 'pgsql' substring then the '/postgresql' suffix is
+# automatically appended (see the upstream INSTALL file for details). Note
+# that the same rule is applied for the datadir and docdir paths. Also if the
+# root directory is /usr, then the resulting sysconfdir path is
+# /etc/postgresql (rather than /usr/etc/postgresql).
+#
+# Let's do the same for the sysconfdir to increase the chance that libpq will
+# find the configuration file. Note that we don't install anything at this
+# path and don't amend the install.data and install.doc path variables. We
+# also use the same default path as the upstream package. Also note that on
+# Windows the default path doesn't make any sense so let's make it empty
+# instead.
+#
+if ($install.root != [null])
+{
+ root = $install.resolve($install.root)
+ sysconfdir = ($windows || $root != /usr ? $root/etc : /etc)
+
+ if! $regex.match("$sysconfdir", '.*(pgsql|postgresql).*')
+ sysconfdir = $sysconfdir/postgresql
+}
+else
+ sysconfdir = ($windows ? '' : /usr/local/pgsql/etc)
+
+# Escape backslashes and quotes in the directory path prior to representing it
+# as C string literals.
+#
+sd = $regex.replace($sysconfdir, '(\\|")', '\\\1')
+
+# If we ever enable National Language Support then we will need to define the
+# LOCALEDIR macro as well. It refers to the locale data directory and should
+# be $install.data/locale by default. We will also need to install this
+# directory (see configure script --enable-nls options and the libpq/po
+# directory in the upstream package for details).
+#
+pq/obj{fe-connect}: c.poptions += -DSYSCONFDIR="\"$sd\""
+
+switch $c.class
+{
+ case 'gcc'
+ {
+ # Omit -fexcess-precision=standard since -std=9x implies it.
+ #
+ c.coptions += -fno-strict-aliasing -fwrapv
+
+ # Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem
+ # to care about these and it is not easy to disable specific warnings in a
+ # way that works across compilers/version (some -Wno-* options are only
+ # recognized in newer versions).
+ #
+ c.coptions += -Wno-all -Wno-extra
+ }
+ case 'msvc'
+ {
+ c.coptions += /GF
+
+ # Disable warnings that pop up with /W3.
+ #
+ c.coptions += /wd4018 /wd4244 /wd4267
+ }
+}
+
+# On Windows the upstream package also adds the resource file to the library.
+# The file contains only the version information. First, libpq.rc is produced
+# from libpq.rc.in with the following command:
+#
+# sed -e 's/\(VERSION.*\),0 *$/\1,'`date '+%y%j' | \
+# sed 's/^0*//'`'/' libpq.rc.in >libpq.rc
+#
+# Then libpq.rc is compiled with:
+#
+# windres -i libpq.rc -o libpqrc.o
+#
+# Afterwards libpqrc.o is linked to the library.
+#
+# @@ Currently we don't have support for the first two steps.
+#
+switch $tclass, $tsys
+{
+ case 'windows', 'mingw32'
+ c.libs += -lsecur32 -lws2_32
+
+ case 'windows'
+ c.libs += secur32.lib ws2_32.lib advapi32.lib
+
+ case 'linux' | 'bsd'
+ {
+ # Make sure all symbols are resolvable.
+ #
+ c.loptions += -Wl,--no-undefined
+
+ c.loptions += "-Wl,--version-script=$src_base/libpqdll.map"
+
+ c.libs += -lpthread
+ }
+
+ default
+ c.libs += -lpthread
+}
+
+# Export options.
+#
+lib{pq}: cc.export.poptions = "-I$src_base" "-I$src_base/pq" \
+ "-I$src_base/include"
+
+# See bootstrap.build for details.
+#
+if $version.pre_release
+ lib{pq}: bin.lib.version = @"-$version.project_id"
+else
+ lib{pq}: bin.lib.version = @"-$abi_major" linux@"$abi_major.$abi_minor"
+
+# Install the bare minimum of headers not recreating subdirectories.
+#
+# Note that upstream also installs several 'unofficial API' headers, that we
+# won't install.
+#
+h{*}: install = false
+
+for h: pq/{libpq-fe libpq-events} include/postgres_ext pg_config_ext
+ h{$h}@./$path.directory($h): install = include/
+
+# Install the config file example as the upstream does.
+#
+pq/file{pg_service.conf.sample}@pq/: install = data/
diff --git a/libpq/libpq/common/base64.c b/libpq/libpq/common/base64.c
new file mode 120000
index 0000000..6883927
--- /dev/null
+++ b/libpq/libpq/common/base64.c
@@ -0,0 +1 @@
+../../../upstream/src/common/base64.c \ No newline at end of file
diff --git a/libpq/libpq/common/ip.c b/libpq/libpq/common/ip.c
new file mode 120000
index 0000000..48e8123
--- /dev/null
+++ b/libpq/libpq/common/ip.c
@@ -0,0 +1 @@
+../../../upstream/src/common/ip.c \ No newline at end of file
diff --git a/libpq/libpq/common/link-canary.c b/libpq/libpq/common/link-canary.c
new file mode 120000
index 0000000..cf578d8
--- /dev/null
+++ b/libpq/libpq/common/link-canary.c
@@ -0,0 +1 @@
+../../../upstream/src/common/link-canary.c \ No newline at end of file
diff --git a/libpq/libpq/common/md5.c b/libpq/libpq/common/md5.c
new file mode 120000
index 0000000..a2eae90
--- /dev/null
+++ b/libpq/libpq/common/md5.c
@@ -0,0 +1 @@
+../../../upstream/src/common/md5.c \ No newline at end of file
diff --git a/libpq/libpq/common/saslprep.c b/libpq/libpq/common/saslprep.c
new file mode 120000
index 0000000..5f5215d
--- /dev/null
+++ b/libpq/libpq/common/saslprep.c
@@ -0,0 +1 @@
+../../../upstream/src/common/saslprep.c \ No newline at end of file
diff --git a/libpq/libpq/common/scram-common.c b/libpq/libpq/common/scram-common.c
new file mode 120000
index 0000000..11927e2
--- /dev/null
+++ b/libpq/libpq/common/scram-common.c
@@ -0,0 +1 @@
+../../../upstream/src/common/scram-common.c \ No newline at end of file
diff --git a/libpq/libpq/common/sha2_openssl.c b/libpq/libpq/common/sha2_openssl.c
new file mode 120000
index 0000000..4d52df2
--- /dev/null
+++ b/libpq/libpq/common/sha2_openssl.c
@@ -0,0 +1 @@
+../../../upstream/src/common/sha2_openssl.c \ No newline at end of file
diff --git a/libpq/libpq/common/unicode_norm.c b/libpq/libpq/common/unicode_norm.c
new file mode 120000
index 0000000..fdb3f72
--- /dev/null
+++ b/libpq/libpq/common/unicode_norm.c
@@ -0,0 +1 @@
+../../../upstream/src/common/unicode_norm.c \ No newline at end of file
diff --git a/libpq/libpq/include/c.h b/libpq/libpq/include/c.h
new file mode 120000
index 0000000..6f95f77
--- /dev/null
+++ b/libpq/libpq/include/c.h
@@ -0,0 +1 @@
+../../../upstream/src/include/c.h \ No newline at end of file
diff --git a/libpq/libpq/include/common b/libpq/libpq/include/common
new file mode 120000
index 0000000..4379965
--- /dev/null
+++ b/libpq/libpq/include/common
@@ -0,0 +1 @@
+../../../upstream/src/include/common \ No newline at end of file
diff --git a/libpq/libpq/include/getaddrinfo.h b/libpq/libpq/include/getaddrinfo.h
new file mode 120000
index 0000000..7ab1ba8
--- /dev/null
+++ b/libpq/libpq/include/getaddrinfo.h
@@ -0,0 +1 @@
+../../../upstream/src/include/getaddrinfo.h \ No newline at end of file
diff --git a/libpq/libpq/include/libpq/libpq-fs.h b/libpq/libpq/include/libpq/libpq-fs.h
new file mode 120000
index 0000000..9030b6b
--- /dev/null
+++ b/libpq/libpq/include/libpq/libpq-fs.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/libpq/libpq-fs.h \ No newline at end of file
diff --git a/libpq/libpq/include/libpq/pqcomm.h b/libpq/libpq/include/libpq/pqcomm.h
new file mode 120000
index 0000000..69de3bc
--- /dev/null
+++ b/libpq/libpq/include/libpq/pqcomm.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/libpq/pqcomm.h \ No newline at end of file
diff --git a/libpq/libpq/include/mb/pg_wchar.h b/libpq/libpq/include/mb/pg_wchar.h
new file mode 120000
index 0000000..ed65657
--- /dev/null
+++ b/libpq/libpq/include/mb/pg_wchar.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/mb/pg_wchar.h \ No newline at end of file
diff --git a/libpq/libpq/include/pg_config_manual.h b/libpq/libpq/include/pg_config_manual.h
new file mode 120000
index 0000000..485eb76
--- /dev/null
+++ b/libpq/libpq/include/pg_config_manual.h
@@ -0,0 +1 @@
+../../../upstream/src/include/pg_config_manual.h \ No newline at end of file
diff --git a/libpq/libpq/include/port.h b/libpq/libpq/include/port.h
new file mode 120000
index 0000000..82aed06
--- /dev/null
+++ b/libpq/libpq/include/port.h
@@ -0,0 +1 @@
+../../../upstream/src/include/port.h \ No newline at end of file
diff --git a/libpq/libpq/include/port/darwin.h b/libpq/libpq/include/port/darwin.h
new file mode 120000
index 0000000..7844da8
--- /dev/null
+++ b/libpq/libpq/include/port/darwin.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/darwin.h \ No newline at end of file
diff --git a/libpq/libpq/include/port/freebsd.h b/libpq/libpq/include/port/freebsd.h
new file mode 120000
index 0000000..7685fa5
--- /dev/null
+++ b/libpq/libpq/include/port/freebsd.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/freebsd.h \ No newline at end of file
diff --git a/libpq/libpq/include/port/linux.h b/libpq/libpq/include/port/linux.h
new file mode 120000
index 0000000..3e054ce
--- /dev/null
+++ b/libpq/libpq/include/port/linux.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/linux.h \ No newline at end of file
diff --git a/libpq/libpq/include/port/pg_bswap.h b/libpq/libpq/include/port/pg_bswap.h
new file mode 120000
index 0000000..876bcb7
--- /dev/null
+++ b/libpq/libpq/include/port/pg_bswap.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/pg_bswap.h \ No newline at end of file
diff --git a/libpq/libpq/include/port/win32 b/libpq/libpq/include/port/win32
new file mode 120000
index 0000000..306f506
--- /dev/null
+++ b/libpq/libpq/include/port/win32
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/win32 \ No newline at end of file
diff --git a/libpq/libpq/include/port/win32.h b/libpq/libpq/include/port/win32.h
new file mode 120000
index 0000000..f48b8ef
--- /dev/null
+++ b/libpq/libpq/include/port/win32.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/win32.h \ No newline at end of file
diff --git a/libpq/libpq/include/port/win32_msvc b/libpq/libpq/include/port/win32_msvc
new file mode 120000
index 0000000..bf2a9ef
--- /dev/null
+++ b/libpq/libpq/include/port/win32_msvc
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/win32_msvc \ No newline at end of file
diff --git a/libpq/libpq/include/port/win32_port.h b/libpq/libpq/include/port/win32_port.h
new file mode 120000
index 0000000..c91e3e1
--- /dev/null
+++ b/libpq/libpq/include/port/win32_port.h
@@ -0,0 +1 @@
+../../../../upstream/src/include/port/win32_port.h \ No newline at end of file
diff --git a/libpq/libpq/include/postgres_ext.h b/libpq/libpq/include/postgres_ext.h
new file mode 120000
index 0000000..d0a22aa
--- /dev/null
+++ b/libpq/libpq/include/postgres_ext.h
@@ -0,0 +1 @@
+../../../upstream/src/include/postgres_ext.h \ No newline at end of file
diff --git a/libpq/libpq/include/postgres_fe.h b/libpq/libpq/include/postgres_fe.h
new file mode 120000
index 0000000..5277360
--- /dev/null
+++ b/libpq/libpq/include/postgres_fe.h
@@ -0,0 +1 @@
+../../../upstream/src/include/postgres_fe.h \ No newline at end of file
diff --git a/libpq/libpq/libpqdll.def b/libpq/libpq/libpqdll.def
new file mode 100644
index 0000000..d74056c
--- /dev/null
+++ b/libpq/libpq/libpqdll.def
@@ -0,0 +1,178 @@
+;LIBRARY LIBPQ
+EXPORTS
+ PQconnectdb @ 1
+ PQsetdbLogin @ 2
+ PQconndefaults @ 3
+ PQfinish @ 4
+ PQreset @ 5
+ PQrequestCancel @ 6
+ PQdb @ 7
+ PQuser @ 8
+ PQpass @ 9
+ PQhost @ 10
+ PQport @ 11
+ PQtty @ 12
+ PQoptions @ 13
+ PQstatus @ 14
+ PQerrorMessage @ 15
+ PQsocket @ 16
+ PQbackendPID @ 17
+ PQtrace @ 18
+ PQuntrace @ 19
+ PQsetNoticeProcessor @ 20
+ PQexec @ 21
+ PQnotifies @ 22
+ PQsendQuery @ 23
+ PQgetResult @ 24
+ PQisBusy @ 25
+ PQconsumeInput @ 26
+ PQgetline @ 27
+ PQputline @ 28
+ PQgetlineAsync @ 29
+ PQputnbytes @ 30
+ PQendcopy @ 31
+ PQfn @ 32
+ PQresultStatus @ 33
+ PQntuples @ 34
+ PQnfields @ 35
+ PQbinaryTuples @ 36
+ PQfname @ 37
+ PQfnumber @ 38
+ PQftype @ 39
+ PQfsize @ 40
+ PQfmod @ 41
+ PQcmdStatus @ 42
+ PQoidStatus @ 43
+ PQcmdTuples @ 44
+ PQgetvalue @ 45
+ PQgetlength @ 46
+ PQgetisnull @ 47
+ PQclear @ 48
+ PQmakeEmptyPGresult @ 49
+ PQprint @ 50
+ PQdisplayTuples @ 51
+ PQprintTuples @ 52
+ lo_open @ 53
+ lo_close @ 54
+ lo_read @ 55
+ lo_write @ 56
+ lo_lseek @ 57
+ lo_creat @ 58
+ lo_tell @ 59
+ lo_unlink @ 60
+ lo_import @ 61
+ lo_export @ 62
+ pgresStatus @ 63
+ PQmblen @ 64
+ PQresultErrorMessage @ 65
+ PQresStatus @ 66
+ termPQExpBuffer @ 67
+ appendPQExpBufferChar @ 68
+ initPQExpBuffer @ 69
+ resetPQExpBuffer @ 70
+ PQoidValue @ 71
+ PQclientEncoding @ 72
+ PQenv2encoding @ 73
+ appendBinaryPQExpBuffer @ 74
+ appendPQExpBufferStr @ 75
+ destroyPQExpBuffer @ 76
+ createPQExpBuffer @ 77
+ PQconninfoFree @ 78
+ PQconnectPoll @ 79
+ PQconnectStart @ 80
+ PQflush @ 81
+ PQisnonblocking @ 82
+ PQresetPoll @ 83
+ PQresetStart @ 84
+ PQsetClientEncoding @ 85
+ PQsetnonblocking @ 86
+ PQfreeNotify @ 87
+ PQescapeString @ 88
+ PQescapeBytea @ 89
+ printfPQExpBuffer @ 90
+ appendPQExpBuffer @ 91
+ pg_encoding_to_char @ 92
+ pg_utf_mblen @ 93
+ PQunescapeBytea @ 94
+ PQfreemem @ 95
+ PQtransactionStatus @ 96
+ PQparameterStatus @ 97
+ PQprotocolVersion @ 98
+ PQsetErrorVerbosity @ 99
+ PQsetNoticeReceiver @ 100
+ PQexecParams @ 101
+ PQsendQueryParams @ 102
+ PQputCopyData @ 103
+ PQputCopyEnd @ 104
+ PQgetCopyData @ 105
+ PQresultErrorField @ 106
+ PQftable @ 107
+ PQftablecol @ 108
+ PQfformat @ 109
+ PQexecPrepared @ 110
+ PQsendQueryPrepared @ 111
+ PQdsplen @ 112
+ PQserverVersion @ 113
+ PQgetssl @ 114
+ pg_char_to_encoding @ 115
+ pg_valid_server_encoding @ 116
+ pqsignal @ 117
+ PQprepare @ 118
+ PQsendPrepare @ 119
+ PQgetCancel @ 120
+ PQfreeCancel @ 121
+ PQcancel @ 122
+ lo_create @ 123
+ PQinitSSL @ 124
+ PQregisterThreadLock @ 125
+ PQescapeStringConn @ 126
+ PQescapeByteaConn @ 127
+ PQencryptPassword @ 128
+ PQisthreadsafe @ 129
+ enlargePQExpBuffer @ 130
+ PQnparams @ 131
+ PQparamtype @ 132
+ PQdescribePrepared @ 133
+ PQdescribePortal @ 134
+ PQsendDescribePrepared @ 135
+ PQsendDescribePortal @ 136
+ lo_truncate @ 137
+ PQconnectionUsedPassword @ 138
+ pg_valid_server_encoding_id @ 139
+ PQconnectionNeedsPassword @ 140
+ lo_import_with_oid @ 141
+ PQcopyResult @ 142
+ PQsetResultAttrs @ 143
+ PQsetvalue @ 144
+ PQresultAlloc @ 145
+ PQregisterEventProc @ 146
+ PQinstanceData @ 147
+ PQsetInstanceData @ 148
+ PQresultInstanceData @ 149
+ PQresultSetInstanceData @ 150
+ PQfireResultCreateEvents @ 151
+ PQconninfoParse @ 152
+ PQinitOpenSSL @ 153
+ PQescapeLiteral @ 154
+ PQescapeIdentifier @ 155
+ PQconnectdbParams @ 156
+ PQconnectStartParams @ 157
+ PQping @ 158
+ PQpingParams @ 159
+ PQlibVersion @ 160
+ PQsetSingleRowMode @ 161
+ lo_lseek64 @ 162
+ lo_tell64 @ 163
+ lo_truncate64 @ 164
+ PQconninfo @ 165
+ PQsslInUse @ 166
+ PQsslStruct @ 167
+ PQsslAttributeNames @ 168
+ PQsslAttribute @ 169
+ PQsetErrorContextVisibility @ 170
+ PQresultVerboseErrorMessage @ 171
+ PQencryptPasswordConn @ 172
+ PQresultMemorySize @ 173
+ PQhostaddr @ 174
+ PQgssEncInUse @ 175
+ PQgetgssctx @ 176
diff --git a/libpq/libpq/libpqdll.map b/libpq/libpq/libpqdll.map
new file mode 100644
index 0000000..893dc86
--- /dev/null
+++ b/libpq/libpq/libpqdll.map
@@ -0,0 +1,178 @@
+{ global:
+PQconnectdb;
+PQsetdbLogin;
+PQconndefaults;
+PQfinish;
+PQreset;
+PQrequestCancel;
+PQdb;
+PQuser;
+PQpass;
+PQhost;
+PQport;
+PQtty;
+PQoptions;
+PQstatus;
+PQerrorMessage;
+PQsocket;
+PQbackendPID;
+PQtrace;
+PQuntrace;
+PQsetNoticeProcessor;
+PQexec;
+PQnotifies;
+PQsendQuery;
+PQgetResult;
+PQisBusy;
+PQconsumeInput;
+PQgetline;
+PQputline;
+PQgetlineAsync;
+PQputnbytes;
+PQendcopy;
+PQfn;
+PQresultStatus;
+PQntuples;
+PQnfields;
+PQbinaryTuples;
+PQfname;
+PQfnumber;
+PQftype;
+PQfsize;
+PQfmod;
+PQcmdStatus;
+PQoidStatus;
+PQcmdTuples;
+PQgetvalue;
+PQgetlength;
+PQgetisnull;
+PQclear;
+PQmakeEmptyPGresult;
+PQprint;
+PQdisplayTuples;
+PQprintTuples;
+lo_open;
+lo_close;
+lo_read;
+lo_write;
+lo_lseek;
+lo_creat;
+lo_tell;
+lo_unlink;
+lo_import;
+lo_export;
+pgresStatus;
+PQmblen;
+PQresultErrorMessage;
+PQresStatus;
+termPQExpBuffer;
+appendPQExpBufferChar;
+initPQExpBuffer;
+resetPQExpBuffer;
+PQoidValue;
+PQclientEncoding;
+PQenv2encoding;
+appendBinaryPQExpBuffer;
+appendPQExpBufferStr;
+destroyPQExpBuffer;
+createPQExpBuffer;
+PQconninfoFree;
+PQconnectPoll;
+PQconnectStart;
+PQflush;
+PQisnonblocking;
+PQresetPoll;
+PQresetStart;
+PQsetClientEncoding;
+PQsetnonblocking;
+PQfreeNotify;
+PQescapeString;
+PQescapeBytea;
+printfPQExpBuffer;
+appendPQExpBuffer;
+pg_encoding_to_char;
+pg_utf_mblen;
+PQunescapeBytea;
+PQfreemem;
+PQtransactionStatus;
+PQparameterStatus;
+PQprotocolVersion;
+PQsetErrorVerbosity;
+PQsetNoticeReceiver;
+PQexecParams;
+PQsendQueryParams;
+PQputCopyData;
+PQputCopyEnd;
+PQgetCopyData;
+PQresultErrorField;
+PQftable;
+PQftablecol;
+PQfformat;
+PQexecPrepared;
+PQsendQueryPrepared;
+PQdsplen;
+PQserverVersion;
+PQgetssl;
+pg_char_to_encoding;
+pg_valid_server_encoding;
+pqsignal;
+PQprepare;
+PQsendPrepare;
+PQgetCancel;
+PQfreeCancel;
+PQcancel;
+lo_create;
+PQinitSSL;
+PQregisterThreadLock;
+PQescapeStringConn;
+PQescapeByteaConn;
+PQencryptPassword;
+PQisthreadsafe;
+enlargePQExpBuffer;
+PQnparams;
+PQparamtype;
+PQdescribePrepared;
+PQdescribePortal;
+PQsendDescribePrepared;
+PQsendDescribePortal;
+lo_truncate;
+PQconnectionUsedPassword;
+pg_valid_server_encoding_id;
+PQconnectionNeedsPassword;
+lo_import_with_oid;
+PQcopyResult;
+PQsetResultAttrs;
+PQsetvalue;
+PQresultAlloc;
+PQregisterEventProc;
+PQinstanceData;
+PQsetInstanceData;
+PQresultInstanceData;
+PQresultSetInstanceData;
+PQfireResultCreateEvents;
+PQconninfoParse;
+PQinitOpenSSL;
+PQescapeLiteral;
+PQescapeIdentifier;
+PQconnectdbParams;
+PQconnectStartParams;
+PQping;
+PQpingParams;
+PQlibVersion;
+PQsetSingleRowMode;
+lo_lseek64;
+lo_tell64;
+lo_truncate64;
+PQconninfo;
+PQsslInUse;
+PQsslStruct;
+PQsslAttributeNames;
+PQsslAttribute;
+PQsetErrorContextVisibility;
+PQresultVerboseErrorMessage;
+PQencryptPasswordConn;
+PQresultMemorySize;
+PQhostaddr;
+PQgssEncInUse;
+PQgetgssctx;
+ local: *; };
diff --git a/libpq/libpq/mb/encnames.c b/libpq/libpq/mb/encnames.c
new file mode 120000
index 0000000..c4e83b6
--- /dev/null
+++ b/libpq/libpq/mb/encnames.c
@@ -0,0 +1 @@
+../../../upstream/src/backend/utils/mb/encnames.c \ No newline at end of file
diff --git a/libpq/libpq/mb/wchar.c b/libpq/libpq/mb/wchar.c
new file mode 120000
index 0000000..fdacab3
--- /dev/null
+++ b/libpq/libpq/mb/wchar.c
@@ -0,0 +1 @@
+../../../upstream/src/backend/utils/mb/wchar.c \ No newline at end of file
diff --git a/libpq/libpq/pg_config.h b/libpq/libpq/pg_config.h
new file mode 100644
index 0000000..12d418e
--- /dev/null
+++ b/libpq/libpq/pg_config.h
@@ -0,0 +1,369 @@
+/* file : libpq/pg_config.h -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : PostgreSQL License; see accompanying COPYRIGHT file
+ */
+
+/*
+ * For the semantics of the following macros refer to pg_config.h.in.orig,
+ * pg_config.h.win32.orig, and the upstream's configure.in.
+ *
+ * Note that we will explicitly undefine macros that are present in the libpq
+ * source code but should not be defined. While this is not technically
+ * required, it simplifies the change tracking (see README-DEV). As a bonus we
+ * also make sure that they are not get eventually defined by some system
+ * headers.
+ */
+
+#include <stddef.h> /* offsetof() */
+
+#include <openssl/opensslv.h> /* OPENSSL_VERSION_NUMBER */
+
+/*
+ * Version.
+ */
+#undef PG_VERSION
+#undef PG_VERSION_NUM
+#undef PG_MAJORVERSION
+#include <libpq/version.h>
+
+/*
+ * Endianess.
+ */
+#ifdef __FreeBSD__
+# include <sys/endian.h> /* BYTE_ORDER */
+#else
+# if defined(_WIN32)
+# ifndef BYTE_ORDER
+# define BIG_ENDIAN 4321
+# define LITTLE_ENDIAN 1234
+# define BYTE_ORDER LITTLE_ENDIAN
+# endif
+# else
+# include <sys/param.h> /* BYTE_ORDER/__BYTE_ORDER */
+# ifndef BYTE_ORDER
+# ifdef __BYTE_ORDER
+# define BYTE_ORDER __BYTE_ORDER
+# define BIG_ENDIAN __BIG_ENDIAN
+# define LITTLE_ENDIAN __LITTLE_ENDIAN
+# else
+# error no BYTE_ORDER/__BYTE_ORDER define
+# endif
+# endif
+# endif
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+# define WORDS_BIGENDIAN 1
+#endif
+
+/*
+ * Types, type sizes and alignments.
+ */
+#define ALIGNOF_(type) offsetof (struct {char c; type m;}, m)
+#define ALIGNOF_DOUBLE ALIGNOF_ (double)
+#define ALIGNOF_INT ALIGNOF_ (int)
+#define ALIGNOF_LONG ALIGNOF_ (long)
+#define ALIGNOF_SHORT ALIGNOF_ (short)
+
+/*
+ * GCC and Clang provide __SIZEOF_*__ and __*_TYPE__ predefined macros that we
+ * use to define the required libpq macros. Note that on Windows long and
+ * long long types are always of 32 and 64 bits width respectively.
+ */
+#ifndef _WIN32
+# if __SIZEOF_LONG__ == 8
+# define HAVE_LONG_INT_64 1
+# endif
+# ifdef __SIZEOF_LONG_LONG__
+# define HAVE_LONG_LONG_INT 1
+# endif
+# if __SIZEOF_LONG_LONG__ == 8
+# define HAVE_LONG_LONG_INT_64 1
+# endif
+# if __SIZEOF_LONG_LONG__ > __SIZEOF_DOUBLE__
+# define MAXIMUM_ALIGNOF __SIZEOF_LONG_LONG__
+# else
+# define MAXIMUM_ALIGNOF __SIZEOF_DOUBLE__
+# endif
+# ifdef __SIZEOF_INT128__
+# define PG_INT128_TYPE __int128
+# define ALIGNOF_PG_INT128_TYPE 16
+# endif
+# define PG_INT64_TYPE __INT64_TYPE__
+# define ACCEPT_TYPE_ARG3 socklen_t
+# define SIZEOF_SIZE_T __SIZEOF_SIZE_T__
+#else
+# define HAVE_LONG_LONG_INT 1
+# define HAVE_LONG_LONG_INT_64 1
+# define MAXIMUM_ALIGNOF 8
+# define PG_INT64_TYPE long long int
+# define ACCEPT_TYPE_ARG3 int
+# ifdef _WIN64
+# define SIZEOF_SIZE_T 8
+# else
+# define SIZEOF_SIZE_T 4
+# endif
+#endif
+
+#define INT64_MODIFIER "ll"
+#define SIZEOF_BOOL 1
+
+/*
+ * Specific for FreeBSD.
+ */
+#ifdef __FreeBSD__
+# define HAVE_STRUCT_CMSGCRED 1
+#endif
+
+/*
+ * Specific for Mac OS.
+ */
+#ifdef __APPLE__
+# define HAVE_DECL_F_FULLFSYNC 1
+#else
+# define HAVE_DECL_F_FULLFSYNC 0
+#endif
+
+/*
+ * Specific for FreeBSD and Linux.
+ */
+#if defined(__FreeBSD__) || defined(__linux__)
+# define HAVE_STRCHRNUL 1
+#endif
+
+/*
+ * Specific for FreeBSD and Mac OS.
+ */
+#if defined(__FreeBSD__) || defined(__APPLE__)
+# define HAVE_DECL_STRLCAT 1
+# define HAVE_DECL_STRLCPY 1
+# define STRERROR_R_INT 1
+# define HAVE_FLS 1
+# define HAVE_GETPEEREID 1
+# define HAVE_STRTOQ 1
+# define HAVE_STRTOUQ 1
+# define HAVE_STRUCT_SOCKADDR_SA_LEN 1
+# define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1
+# define HAVE_SYS_SOCKIO_H 1
+# define HAVE_SYS_UCRED_H 1
+# define HAVE_UNION_SEMUN 1
+#else
+# define HAVE_DECL_STRLCAT 0
+# define HAVE_DECL_STRLCPY 0
+#endif
+
+/*
+ * Specific for POSIX.
+ */
+#ifndef _WIN32
+# define HAVE_CRYPT 1
+# define HAVE_DECL_FDATASYNC 1
+# define HAVE_DECL_RTLD_GLOBAL 1
+# define HAVE_DECL_RTLD_NOW 1
+# define HAVE_FDATASYNC 1
+# define HAVE_GETADDRINFO 1
+# define HAVE_GETIFADDRS 1
+# define HAVE_IFADDRS_H 1
+# define HAVE_GETPWUID_R 1
+# define HAVE_INET_ATON 1
+# define HAVE_LANGINFO_H 1
+# define HAVE_MKDTEMP 1
+# define HAVE_NETINET_TCP_H 1
+# define HAVE_NET_IF_H 1
+# define HAVE_DECL_POSIX_FADVISE 1
+# define HAVE_POSIX_FADVISE 1
+# define HAVE_RANDOM 1
+# define HAVE_SRANDOM 1
+# define HAVE_STRERROR_R 1
+# define HAVE_STRINGS_H 1
+# define HAVE_SYS_IOCTL_H 1
+# define HAVE_POLL 1
+# define HAVE_POLL_H 1
+# define HAVE_SYS_POLL_H 1
+# define HAVE_SYS_SELECT_H 1
+# define HAVE_SYS_UN_H 1
+# define HAVE_TERMIOS_H 1
+# define HAVE_UNIX_SOCKETS 1
+# define HAVE_UNSETENV 1
+# define USE_INTEGER_DATETIMES 1
+# define HAVE_DLOPEN 1
+# define HAVE_PREAD 1
+# define HAVE_PWRITE 1
+/*
+ * Specific for Windows.
+ */
+#else
+# define HAVE_DECL_FDATASYNC 0
+# define HAVE_DECL_RTLD_GLOBAL 0
+# define HAVE_DECL_RTLD_NOW 0
+# define HAVE_DECL_POSIX_FADVISE 0
+# define HAVE_GETTIMEOFDAY 1
+# define HAVE_ISINF 1
+# define HAVE_FUNCNAME__FUNCTION 1
+# define USE_REPL_SNPRINTF 1
+#endif
+
+/*
+ * Specific for GNU C Library.
+ */
+#ifdef __GLIBC__
+# define HAVE_GETHOSTBYNAME_R 1
+#endif
+
+/*
+ * Specific for (non-) VC.
+ */
+#ifndef _MSC_VER
+# define HAVE__BUILTIN_TYPES_COMPATIBLE_P 1
+# define HAVE__BUILTIN_UNREACHABLE 1
+# define HAVE__BUILTIN_BSWAP16 1
+# define HAVE__BUILTIN_BSWAP32 1
+# define HAVE__BUILTIN_BSWAP64 1
+# define HAVE__BUILTIN_OP_OVERFLOW 1
+#endif
+
+/*
+ * Relates to the enabled OpenSSL.
+ */
+#define USE_OPENSSL 1
+#define HAVE_OPENSSL_INIT_SSL 1
+#define HAVE_ASN1_STRING_GET0_DATA 1
+#define HAVE_BIO_GET_DATA 1
+#define HAVE_BIO_METH_NEW 1
+#define HAVE_SSL_CLEAR_OPTIONS 1
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+# define HAVE_CRYPTO_LOCK 1
+#endif
+
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+# define HAVE_X509_GET_SIGNATURE_NID 1
+#endif
+
+#define USE_OPENSSL_RANDOM 1
+#undef USE_DEV_URANDOM
+#undef USE_WIN32_RANDOM
+
+/*
+ * Common for all supported OSes/compilers.
+ */
+#define ENABLE_THREAD_SAFETY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_RINT 1
+#define HAVE_DECL_SNPRINTF 1
+#define HAVE_DECL_VSNPRINTF 1
+#define HAVE_DECL_STRNLEN 1
+#define HAVE_DECL_STRTOLL 1
+#define HAVE_DECL_STRTOULL 1
+#define HAVE_FSEEKO 1
+#define HAVE_FUNCNAME__FUNC 1
+#define HAVE_IPV6 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDBOOL_H 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOF 1
+#define HAVE_TOWLOWER 1
+#define HAVE_WCSTOMBS 1
+#define HAVE_SSL_GET_CURRENT_COMPRESSION 1
+#define HAVE_STRUCT_ADDRINFO 1
+#define HAVE_STRUCT_SOCKADDR_STORAGE 1
+#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+#define BLCKSZ 8192
+#define XLOG_BLCKSZ 8192
+#define PG_KRB_SRVNAM "postgres"
+#define PG_PRINTF_ATTRIBUTE printf
+#define FLEXIBLE_ARRAY_MEMBER
+#define MEMSET_LOOP_LIMIT 1024
+#define DEF_PGPORT 5432
+#define DEF_PGPORT_STR "5432"
+
+/*
+ * _Static_assert() was introduced in C11. However, all the latest major
+ * compilers support it for C99 as well.
+ */
+#define HAVE__STATIC_ASSERT 1
+
+/*
+ * Undefined macros.
+ */
+
+/*
+ * The following features are disabled.
+ */
+#undef USE_ASSERT_CHECKING
+#undef ENABLE_NLS
+#undef ENABLE_GSS
+#undef USE_LDAP
+
+/*
+ * Is meaningless if NLS support is disabled (see above and libpq/buildfile for
+ * details).
+ */
+#undef LOCALEDIR
+
+/*
+ * Is meaningless if GSSAPI support is disabled (see above). It also seems that
+ * for modern systems including <gssapi.h> or <gssapi/gssapi.h> will work both
+ * (<gssapi.h> just includes <gssapi/gssapi.h>).
+ */
+#undef HAVE_GSSAPI_H
+
+/*
+ * Integer literal LL suffix is optional for C99.
+ */
+#undef HAVE_LL_CONSTANTS
+
+/*
+ * Windows-specific. <crtdefs.h> is included for the latest (>= 1400) VC
+ * unconditionally.
+ */
+#undef HAVE_CRTDEFS_H
+
+/*
+ * Solaris-specific (getpeerucred() function).
+ */
+#undef HAVE_GETPEERUCRED
+
+/*
+ * Hard to even find any records of these types.
+ */
+#undef HAVE_INT64
+#undef HAVE_INT8
+#undef HAVE_UINT64
+#undef HAVE_UINT8
+
+/*
+ * Something optimization-related for PowerPC machines (see
+ * libpq/include/pg_config_manual.h for more details).
+ */
+#undef HAVE_PPC_LWARX_MUTEX_HINT
+
+/*
+ * None of the supported platforms has the '__' prefix for the mentioned
+ * sockaddr_storage struct members.
+ */
+#undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
+#undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN
+
+/*
+ * Let's follow Linux man page advise for sync_file_range() function:
+ *
+ * This system call is Linux-specific, and should be avoided in portable
+ * programs.
+ *
+ * The macro also seems to be backend-specific.
+ */
+#undef HAVE_SYNC_FILE_RANGE
+
+/*
+ * None of the supported OSes have <ucred.h>. FreeBSD and Mac OS have
+ * <sys/ucred.h> (HAVE_SYS_UCRED_H macro).
+ */
+#undef HAVE_UCRED_H
+
+/*
+ * Meaningless as HAVE_STRTOULL and HAVE_STRTOULL are always defined.
+ */
+#undef HAVE___STRTOLL
+#undef HAVE___STRTOULL
diff --git a/libpq/libpq/pg_config.h.in.orig b/libpq/libpq/pg_config.h.in.orig
new file mode 120000
index 0000000..0232148
--- /dev/null
+++ b/libpq/libpq/pg_config.h.in.orig
@@ -0,0 +1 @@
+../../upstream/src/include/pg_config.h.in \ No newline at end of file
diff --git a/libpq/libpq/pg_config.h.win32.orig b/libpq/libpq/pg_config.h.win32.orig
new file mode 120000
index 0000000..9c4d1e1
--- /dev/null
+++ b/libpq/libpq/pg_config.h.win32.orig
@@ -0,0 +1 @@
+../../upstream/src/include/pg_config.h.win32 \ No newline at end of file
diff --git a/libpq/libpq/pg_config_ext.h b/libpq/libpq/pg_config_ext.h
new file mode 100644
index 0000000..e3a9abe
--- /dev/null
+++ b/libpq/libpq/pg_config_ext.h
@@ -0,0 +1,19 @@
+/* file : libpq/pg_config_ext.h -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : PostgreSQL License; see accompanying COPYRIGHT file
+ */
+
+/*
+ * For the semantics of the following macros refer to pg_config_ext.h.in.orig,
+ * pg_config_ext.h.win32.orig, and the upstream's configure.in.
+ */
+
+/*
+ * Note that <stdint.h> is invented by C99 and we can't expect that the libpq
+ * client is compiled according to this standard. However, when compile with
+ * GCC, Clang or VC, even requesting C90 standard explicitly, then the header
+ * and int64_t type are both available.
+ */
+#include <stdint.h>
+
+#define PG_INT64_TYPE int64_t
diff --git a/libpq/libpq/pg_config_ext.h.in.orig b/libpq/libpq/pg_config_ext.h.in.orig
new file mode 120000
index 0000000..22f6198
--- /dev/null
+++ b/libpq/libpq/pg_config_ext.h.in.orig
@@ -0,0 +1 @@
+../../upstream/src/include/pg_config_ext.h.in \ No newline at end of file
diff --git a/libpq/libpq/pg_config_ext.h.win32.orig b/libpq/libpq/pg_config_ext.h.win32.orig
new file mode 120000
index 0000000..e401e39
--- /dev/null
+++ b/libpq/libpq/pg_config_ext.h.win32.orig
@@ -0,0 +1 @@
+../../upstream/src/include/pg_config_ext.h.win32 \ No newline at end of file
diff --git a/libpq/libpq/pg_config_os.h b/libpq/libpq/pg_config_os.h
new file mode 100644
index 0000000..e616265
--- /dev/null
+++ b/libpq/libpq/pg_config_os.h
@@ -0,0 +1,21 @@
+/* file : libpq/pg_config_os.h -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : PostgreSQL License; see accompanying COPYRIGHT file
+ */
+
+/*
+ * The upstream package makefile creates this file as a symlink to the
+ * target-specific header in src/include/port/.
+ */
+
+#if defined(__linux__)
+# include <include/port/linux.h>
+#elif defined(__FreeBSD__)
+# include <include/port/freebsd.h>
+#elif defined(__APPLE__)
+# include <include/port/darwin.h>
+#elif defined(_WIN32)
+# include <include/port/win32.h>
+#else
+# error this OS is not supported
+#endif
diff --git a/libpq/libpq/pg_config_paths.h b/libpq/libpq/pg_config_paths.h
new file mode 100644
index 0000000..2e67511
--- /dev/null
+++ b/libpq/libpq/pg_config_paths.h
@@ -0,0 +1,11 @@
+/* file : libpq/pg_config_paths.h -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : PostgreSQL License; see accompanying COPYRIGHT file
+ */
+
+/*
+ * The upstream package makefile creates this file on the fly, dumping a
+ * number of macro definitions. The libpq source files only use the SYSCONFDIR
+ * macro (for the configuration we package against) which we define via the -D
+ * preprocessor option (see buildfile for details).
+ */
diff --git a/libpq/libpq/port/chklocale.c b/libpq/libpq/port/chklocale.c
new file mode 120000
index 0000000..8447432
--- /dev/null
+++ b/libpq/libpq/port/chklocale.c
@@ -0,0 +1 @@
+../../../upstream/src/port/chklocale.c \ No newline at end of file
diff --git a/libpq/libpq/port/getaddrinfo.c b/libpq/libpq/port/getaddrinfo.c
new file mode 120000
index 0000000..ca07fe4
--- /dev/null
+++ b/libpq/libpq/port/getaddrinfo.c
@@ -0,0 +1 @@
+../../../upstream/src/port/getaddrinfo.c \ No newline at end of file
diff --git a/libpq/libpq/port/getpeereid.c b/libpq/libpq/port/getpeereid.c
new file mode 120000
index 0000000..88e09de
--- /dev/null
+++ b/libpq/libpq/port/getpeereid.c
@@ -0,0 +1 @@
+../../../upstream/src/port/getpeereid.c \ No newline at end of file
diff --git a/libpq/libpq/port/inet_aton.c b/libpq/libpq/port/inet_aton.c
new file mode 120000
index 0000000..dec85cf
--- /dev/null
+++ b/libpq/libpq/port/inet_aton.c
@@ -0,0 +1 @@
+../../../upstream/src/port/inet_aton.c \ No newline at end of file
diff --git a/libpq/libpq/port/inet_net_ntop.c b/libpq/libpq/port/inet_net_ntop.c
new file mode 120000
index 0000000..342abc2
--- /dev/null
+++ b/libpq/libpq/port/inet_net_ntop.c
@@ -0,0 +1 @@
+../../../upstream/src/port/inet_net_ntop.c \ No newline at end of file
diff --git a/libpq/libpq/port/noblock.c b/libpq/libpq/port/noblock.c
new file mode 120000
index 0000000..912f287
--- /dev/null
+++ b/libpq/libpq/port/noblock.c
@@ -0,0 +1 @@
+../../../upstream/src/port/noblock.c \ No newline at end of file
diff --git a/libpq/libpq/port/open.c b/libpq/libpq/port/open.c
new file mode 120000
index 0000000..6cac9e0
--- /dev/null
+++ b/libpq/libpq/port/open.c
@@ -0,0 +1 @@
+../../../upstream/src/port/open.c \ No newline at end of file
diff --git a/libpq/libpq/port/pg_strong_random.c b/libpq/libpq/port/pg_strong_random.c
new file mode 120000
index 0000000..911f1c2
--- /dev/null
+++ b/libpq/libpq/port/pg_strong_random.c
@@ -0,0 +1 @@
+../../../upstream/src/port/pg_strong_random.c \ No newline at end of file
diff --git a/libpq/libpq/port/pgsleep.c b/libpq/libpq/port/pgsleep.c
new file mode 120000
index 0000000..36040ee
--- /dev/null
+++ b/libpq/libpq/port/pgsleep.c
@@ -0,0 +1 @@
+../../../upstream/src/port/pgsleep.c \ No newline at end of file
diff --git a/libpq/libpq/port/pgstrcasecmp.c b/libpq/libpq/port/pgstrcasecmp.c
new file mode 120000
index 0000000..7e5b081
--- /dev/null
+++ b/libpq/libpq/port/pgstrcasecmp.c
@@ -0,0 +1 @@
+../../../upstream/src/port/pgstrcasecmp.c \ No newline at end of file
diff --git a/libpq/libpq/port/pthread-win32.h b/libpq/libpq/port/pthread-win32.h
new file mode 120000
index 0000000..a4a445d
--- /dev/null
+++ b/libpq/libpq/port/pthread-win32.h
@@ -0,0 +1 @@
+../../../upstream/src/port/pthread-win32.h \ No newline at end of file
diff --git a/libpq/libpq/port/snprintf.c b/libpq/libpq/port/snprintf.c
new file mode 120000
index 0000000..a73fb8e
--- /dev/null
+++ b/libpq/libpq/port/snprintf.c
@@ -0,0 +1 @@
+../../../upstream/src/port/snprintf.c \ No newline at end of file
diff --git a/libpq/libpq/port/strerror.c b/libpq/libpq/port/strerror.c
new file mode 120000
index 0000000..733a98c
--- /dev/null
+++ b/libpq/libpq/port/strerror.c
@@ -0,0 +1 @@
+../../../upstream/src/port/strerror.c \ No newline at end of file
diff --git a/libpq/libpq/port/strlcpy.c b/libpq/libpq/port/strlcpy.c
new file mode 120000
index 0000000..0f3db74
--- /dev/null
+++ b/libpq/libpq/port/strlcpy.c
@@ -0,0 +1 @@
+../../../upstream/src/port/strlcpy.c \ No newline at end of file
diff --git a/libpq/libpq/port/system.c b/libpq/libpq/port/system.c
new file mode 120000
index 0000000..80c33eb
--- /dev/null
+++ b/libpq/libpq/port/system.c
@@ -0,0 +1 @@
+../../../upstream/src/port/system.c \ No newline at end of file
diff --git a/libpq/libpq/port/thread.c b/libpq/libpq/port/thread.c
new file mode 120000
index 0000000..c8f5fbf
--- /dev/null
+++ b/libpq/libpq/port/thread.c
@@ -0,0 +1 @@
+../../../upstream/src/port/thread.c \ No newline at end of file
diff --git a/libpq/libpq/port/win32error.c b/libpq/libpq/port/win32error.c
new file mode 120000
index 0000000..02fd874
--- /dev/null
+++ b/libpq/libpq/port/win32error.c
@@ -0,0 +1 @@
+../../../upstream/src/port/win32error.c \ No newline at end of file
diff --git a/libpq/libpq/port/win32setlocale.c b/libpq/libpq/port/win32setlocale.c
new file mode 120000
index 0000000..ab72c17
--- /dev/null
+++ b/libpq/libpq/port/win32setlocale.c
@@ -0,0 +1 @@
+../../../upstream/src/port/win32setlocale.c \ No newline at end of file
diff --git a/libpq/libpq/pq b/libpq/libpq/pq
new file mode 120000
index 0000000..1f95366
--- /dev/null
+++ b/libpq/libpq/pq
@@ -0,0 +1 @@
+../../upstream/src/interfaces/libpq \ No newline at end of file
diff --git a/libpq/libpq/version.h.in b/libpq/libpq/version.h.in
new file mode 100644
index 0000000..0dec491
--- /dev/null
+++ b/libpq/libpq/version.h.in
@@ -0,0 +1,17 @@
+/* file : libpq/version.h.in -*- C -*-
+ * copyright : Copyright (c) 2016-2019 Code Synthesis Ltd
+ * license : PostgreSQL License; see accompanying COPYRIGHT file
+ */
+
+#ifndef PG_MAJORVERSION /* Note: using the version macro itself. */
+
+#define PG_VERSION "$libpq.version.major$.$libpq.version.minor$"
+
+/*
+ * For example, 120001 for 12.1.
+ */
+#define PG_VERSION_NUM (10000 * $libpq.version.major$ + $libpq.version.minor$)
+
+#define PG_MAJORVERSION "$libpq.version.major$"
+
+#endif /* PG_MAJORVERSION */