first import

This commit is contained in:
Pierre Ducroquet 2023-09-20 15:08:38 +02:00
commit 2b45e50adc
11 changed files with 187 additions and 0 deletions

1
COPYING Normal file
View File

@ -0,0 +1 @@

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
PG_CONFIG ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

1
README.md Normal file
View File

@ -0,0 +1 @@

6
debian/changelog vendored Normal file
View File

@ -0,0 +1,6 @@
postgresql-bouncernotice (0.1-1) UNRELEASED; urgency=medium
* First version
-- Pierre Ducroquet <pducroquet@entrouvert.com> Thu, 14 Sep 2023 10:34:22 +0100

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
10

58
debian/control vendored Normal file
View File

@ -0,0 +1,58 @@
Source: postgresql-bouncernotice
Section: database
Priority: optional
Maintainer: Pierre Ducroquet <pducroquet@entrouvert.com>
Uploaders:
Pierre Ducroquet <pducroquet@entrouvert.com>,
Build-Depends:
debhelper (>= 9),
postgresql-server-dev-all,
Standards-Version: 4.1.0
Package: postgresql-13-bouncernotice
Architecture: any
Depends:
postgresql-13,
${misc:Depends},
${shlibs:Depends},
Description: Postgres 13 bouncer notice
postgresql-bouncernotice is a PostgreSQL extension allowing notification of
pgbouncer when specific settings are changed.
.
This package is for PostgreSQL 13.
Package: postgresql-14-bouncernotice
Architecture: any
Depends:
postgresql-14,
${misc:Depends},
${shlibs:Depends},
Description: Postgres 14 bouncer notice
postgresql-bouncernotice is a PostgreSQL extension allowing notification of
pgbouncer when specific settings are changed.
.
This package is for PostgreSQL 14.
Package: postgresql-15-bouncernotice
Architecture: any
Depends:
postgresql-15,
${misc:Depends},
${shlibs:Depends},
Description: Postgres 15 bouncer notice
postgresql-bouncernotice is a PostgreSQL extension allowing notification of
pgbouncer when specific settings are changed.
.
This package is for PostgreSQL 15.
Package: postgresql-16-bouncernotice
Architecture: any
Depends:
postgresql-16,
${misc:Depends},
${shlibs:Depends},
Description: Postgres 16 bouncer notice
postgresql-bouncernotice is a PostgreSQL extension allowing notification of
pgbouncer when specific settings are changed.
.
This package is for PostgreSQL 16.

23
debian/control.in vendored Normal file
View File

@ -0,0 +1,23 @@
Source: postgresql-bouncernotice
Section: database
Priority: optional
Maintainer: Pierre Ducroquet <pducroquet@entrouvert.com>
Uploaders:
Pierre Ducroquet <pducroquet@entrouvert.com>,
Build-Depends:
debhelper (>= 9),
postgresql-server-dev-all,
Standards-Version: 4.1.0
Package: postgresql-PGVERSION-bouncernotice
Architecture: any
Depends:
postgresql-PGVERSION,
${misc:Depends},
${shlibs:Depends},
Description: Postgres PGVERSION bouncer notice
postgresql-bouncernotice is a PostgreSQL extension allowing notification of
pgbouncer when specific settings are changed.
.
This package is for PostgreSQL PGVERSION.

1
debian/copyright vendored Normal file
View File

@ -0,0 +1 @@
all your bases are belong to us

4
debian/pgversions vendored Normal file
View File

@ -0,0 +1,4 @@
13
14
15
16

35
debian/rules vendored Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# Using pg_buildext
include /usr/share/postgresql-common/pgxs_debian_control.mk
# export USE_PGXS=1
export PG_UPDATECONTROL=yes
clean: debian/control
.PHONY: debian/control
override_dh_auto_build:
#+pg_buildext build build-%v
# nothing ?
override_dh_install:
# build all supported versions
+pg_buildext loop postgresql-%v-bouncernotice
override_dh_auto_install:
# nothing ?
override_dh_installdocs:
dh_installdocs --all README.*
override_dh_auto_clean:
+pg_buildext clean build-%v
%:
dh $@

52
src/bouncernotice.c Normal file
View File

@ -0,0 +1,52 @@
/*
* Bouncer notice for PostgreSQL
*
* 2023, Pierre Ducroquet
*/
#include "postgres.h"
#include "fmgr.h"
#include "commands/explain.h"
#include "optimizer/planner.h"
#include "catalog/pg_type.h"
#include "utils/guc.h"
#include "utils/guc_tables.h"
PG_MODULE_MAGIC;
void _PG_init(void);
void _PG_fini(void);
void
_PG_init(void)
{
int num_guc;
struct config_generic **gucs;
/* Setup guc */
// find the guc for search_path, and alter it
#if PG_VERSION_NUM >= 160000
gucs = get_guc_variables(&num_guc);
#else
num_guc = GetNumConfigOptions();
gucs = get_guc_variables();
#endif
for (int i = 0 ; gucs[i] ; i++)
{
// elog(WARNING, "%s with %i", gucs[i]->name, gucs[i]->flags);
if (strcmp(gucs[i]->name, "search_path") == 0) {
gucs[i]->flags |= GUC_REPORT;
// elog(WARNING, "%s with %i", gucs[i]->name, gucs[i]->flags);
}
}
}
void
_PG_fini(void)
{
/* Uninstall hooks. */
elog(WARNING, "Removing bouncer notice");
}