aboutsummaryrefslogtreecommitdiffstats
path: root/community/postgresql-plpgsql_check
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-10-29 00:06:06 +0100
committerJakub Jirutka <jakub@jirutka.cz>2018-10-29 00:38:50 +0100
commit8a52721a28056a8163eb5df54530ba90bdcd8996 (patch)
tree466ef12dcd602ced7fde6b354ca70a689eae3cfc /community/postgresql-plpgsql_check
parent5d4f447e08558a7e469ad1faa1ec262fd1585066 (diff)
downloadaports-8a52721a28056a8163eb5df54530ba90bdcd8996.tar.bz2
aports-8a52721a28056a8163eb5df54530ba90bdcd8996.tar.xz
community/postgresql-plpgsql_check: patch for postgresql 11.0
Diffstat (limited to 'community/postgresql-plpgsql_check')
-rw-r--r--community/postgresql-plpgsql_check/APKBUILD9
-rw-r--r--community/postgresql-plpgsql_check/fix-for-postgresql-11-and-12.patch126
2 files changed, 132 insertions, 3 deletions
diff --git a/community/postgresql-plpgsql_check/APKBUILD b/community/postgresql-plpgsql_check/APKBUILD
index f0b23cfd7c..19c6e6c8cd 100644
--- a/community/postgresql-plpgsql_check/APKBUILD
+++ b/community/postgresql-plpgsql_check/APKBUILD
@@ -3,14 +3,16 @@
pkgname=postgresql-plpgsql_check
_pkgname=plpgsql_check
pkgver=1.2.3
-pkgrel=0
+pkgrel=1
pkgdesc="Additional tools for plpgsql functions validation"
url="https://github.com/okbob/plpgsql_check"
arch="all"
license="BSD"
depends="postgresql"
makedepends="postgresql-dev"
-source="$_pkgname-$pkgver.tar.gz::https://github.com/okbob/$_pkgname/archive/v$pkgver.tar.gz"
+source="$_pkgname-$pkgver.tar.gz::https://github.com/okbob/$_pkgname/archive/v$pkgver.tar.gz
+ fix-for-postgresql-11-and-12.patch
+ "
builddir="$srcdir/$_pkgname-$pkgver"
options="!check" # XXX: installcheck requires running PostgreSQL
@@ -24,4 +26,5 @@ package() {
make USE_PGXS=1 DESTDIR="$pkgdir" install
}
-sha512sums="73c178f19540923394333404612779b692f932f9748085f9a41bd51535d19c15e87b04874f90f387aa197cf2f179e318b202203abd39f6e33e111fe2903e7998 plpgsql_check-1.2.3.tar.gz"
+sha512sums="73c178f19540923394333404612779b692f932f9748085f9a41bd51535d19c15e87b04874f90f387aa197cf2f179e318b202203abd39f6e33e111fe2903e7998 plpgsql_check-1.2.3.tar.gz
+7ee1624175549783e15872d9b3469b959f45d882a830b94b39da069c58d5aa9e75c49c9f52c3a5254ad1854777e9518465b456fcae090a8a5b4f999b32e5ecf0 fix-for-postgresql-11-and-12.patch"
diff --git a/community/postgresql-plpgsql_check/fix-for-postgresql-11-and-12.patch b/community/postgresql-plpgsql_check/fix-for-postgresql-11-and-12.patch
new file mode 100644
index 0000000000..843d9fe834
--- /dev/null
+++ b/community/postgresql-plpgsql_check/fix-for-postgresql-11-and-12.patch
@@ -0,0 +1,126 @@
+From 5dbcd9779ae6b5d5008aaddfa62677adf05dd5e5 Mon Sep 17 00:00:00 2001
+From: Pavel Stehule <pavel.stehule@gmail.com>
+Date: Wed, 10 Oct 2018 16:27:07 +0200
+Subject: [PATCH] fix for PostgreSQL 11,12
+
+Patch-Source: https://github.com/okbob/plpgsql_check/commit/5dbcd9779ae6b5d5008aaddfa62677adf05dd5e5
+---
+ plpgsql_check.c | 43 +++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 37 insertions(+), 6 deletions(-)
+
+diff --git a/plpgsql_check.c b/plpgsql_check.c
+index 8a83b06..b95adf1 100644
+--- a/plpgsql_check.c
++++ b/plpgsql_check.c
+@@ -308,6 +308,8 @@ static int possibly_closed(int c);
+ static Query *ExprGetQuery(PLpgSQL_checkstate *cstate, PLpgSQL_expr *query);
+ static char *ExprGetString(PLpgSQL_checkstate *cstate, PLpgSQL_expr *query, bool *IsConst);
+ static bool exception_matches_conditions(int err_code, PLpgSQL_condition *cond);
++static bool is_internal_variable(PLpgSQL_variable *var);
++
+
+ #if PG_VERSION_NUM >= 110000
+
+@@ -3398,9 +3400,17 @@ is_internal(char *refname, int lineno)
+ return true;
+ if (strcmp(refname, "*internal*") == 0)
+ return true;
++ if (strcmp(refname, "(unnamed row)") == 0)
++ return true;
+ return false;
+ }
+
++static bool
++is_internal_variable(PLpgSQL_variable *var)
++{
++ return is_internal(var->refname, var->lineno);
++}
++
+
+ /*
+ * Returns true if dno is explicitly declared. It should not be used
+@@ -3635,7 +3645,7 @@ report_unused_variables(PLpgSQL_checkstate *cstate)
+ int varno = func->out_param_varno;
+ PLpgSQL_variable *var = (PLpgSQL_variable *) estate->datums[varno];
+
+- if (var->dtype == PLPGSQL_DTYPE_ROW && var->refname == NULL)
++ if (var->dtype == PLPGSQL_DTYPE_ROW && is_internal_variable(var))
+ {
+ /* this function has more OUT parameters */
+ PLpgSQL_row *row = (PLpgSQL_row*) var;
+@@ -5682,25 +5692,46 @@ check_fishy_qual(PLpgSQL_checkstate *cstate, PLpgSQL_expr *query)
+ }
+
+ /*
+- * returns refname of PLpgSQL_datum
++ * returns refname of PLpgSQL_datum. When refname is generated,
++ * then return null too, although refname is not null.
+ */
+ static char *
+ datum_get_refname(PLpgSQL_datum *d)
+ {
++ char *refname;
++ int lineno;
++
+ switch (d->dtype)
+ {
+ case PLPGSQL_DTYPE_VAR:
+- return ((PLpgSQL_var *) d)->refname;
++ refname = ((PLpgSQL_var *) d)->refname;
++ lineno = ((PLpgSQL_var *) d)->lineno;
++ break;
+
+ case PLPGSQL_DTYPE_ROW:
+- return ((PLpgSQL_row *) d)->refname;
++ refname = ((PLpgSQL_row *) d)->refname;
++ lineno = ((PLpgSQL_row *) d)->lineno;
++ break;
+
+ case PLPGSQL_DTYPE_REC:
+- return ((PLpgSQL_rec *) d)->refname;
++ refname = ((PLpgSQL_rec *) d)->refname;
++ lineno = ((PLpgSQL_rec *) d)->lineno;
++ break;
+
+ default:
+- return NULL;
++ refname = NULL;
++ lineno = -1;
+ }
++
++ /*
++ * PostgreSQL 12 started use "(unnamed row)" name for internal
++ * variables. Hide this name too (lineno is -1).
++ */
++ if (strcmp(refname, "(unnamed row)") == 0
++ && lineno == -1)
++ return NULL;
++
++ return refname;
+ }
+
+ /****************************************************************************************
+From b9564b563f99630fcc1fe19d74fb466d899090b8 Mon Sep 17 00:00:00 2001
+From: Pavel Stehule <pavel.stehule@gmail.com>
+Date: Wed, 10 Oct 2018 16:32:56 +0200
+Subject: [PATCH] minor change
+
+Patch-Source: https://github.com/okbob/plpgsql_check/commit/b9564b563f99630fcc1fe19d74fb466d899090b8
+---
+ plpgsql_check.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/plpgsql_check.c b/plpgsql_check.c
+index b95adf1..f9f4e1b 100644
+--- a/plpgsql_check.c
++++ b/plpgsql_check.c
+@@ -5727,8 +5727,7 @@ datum_get_refname(PLpgSQL_datum *d)
+ * PostgreSQL 12 started use "(unnamed row)" name for internal
+ * variables. Hide this name too (lineno is -1).
+ */
+- if (strcmp(refname, "(unnamed row)") == 0
+- && lineno == -1)
++ if (is_internal(refname, lineno))
+ return NULL;
+
+ return refname;