Skip to content

Commit 288e0fd

Browse files
committed
implementation of in-comment options, prepare for 2.2.0
1 parent f5ae5a2 commit 288e0fd

28 files changed

+745
-383
lines changed

META.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "plpgsql_check",
33
"abstract": "Additional tools for plpgsql functions validation",
44
"description": "The plpgsql_check is PostgreSQL extension with functionality for direct or indirect extra validation of functions in plpgsql language. It verifies a validity of SQL identifiers used in plpgsql code. It try to identify a performance issues. Modern versions has integrated profiler. The table and function dependencies can be displayed",
5-
"version": "2.1.10",
5+
"version": "2.2.0",
66
"maintainer": "Pavel STEHULE <pavel.stehule@gmail.com>",
77
"license": "bsd",
88
"provides": {
99
"plpgsql_check": {
1010
"abstract": "Additional tools for plpgsql functions validation",
1111
"file": "sql/plpgsql_check_active.sql",
1212
"docfile": "README.md",
13-
"version": "2.1.10"
13+
"version": "2.2.0"
1414
}
1515
},
1616
"prereqs": {

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
MODULE_big = plpgsql_check
44
OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
5-
DATA = plpgsql_check--2.1.sql
5+
DATA = plpgsql_check--2.2.sql
66
EXTENSION = plpgsql_check
77

88
ifndef MAJORVERSION

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ You can set level of warnings via function's parameters:
172172
* `newtable DEFAULT NULL`, `oldtable DEFAULT NULL` - the names of NEW or OLD transitive
173173
tables. These parameters are required when transitive tables are used.
174174

175+
* `use_incomment_options` - when it is true (default), then in-comment options are active
176+
177+
* `incomment_options_usage_warning` - when it is true (default is false), then the warning is raised when
178+
in-comment option is used.
179+
175180
## Triggers
176181

177182
When you want to check any trigger, you have to enter a relation that will be
@@ -224,6 +229,30 @@ For triggers with transitive tables you can set a `oldtable` or `newtable` param
224229
select * from plpgsql_check_function('footab_trig_func','footab', newtable := 'newtab');
225230

226231

232+
## In-comment options
233+
234+
plpgsql_check allows persistent setting written in comments. These options are taken from
235+
function's source code before checking. The syntax is:
236+
237+
@plpgsql_check_option: optioname [=] value [, optname [=] value ...]
238+
239+
The settings from comment options has top high priority, but generally it can be disabled
240+
by option `use_incomment_options` to `false`.
241+
242+
Example:
243+
244+
create or replace function fx(anyelement)
245+
returns text as $$
246+
begin
247+
/*
248+
* rewrite default polymorphic type to text */
249+
* @plpgsql_check_options: anyelementtype = text
250+
*/
251+
return $1;
252+
end;
253+
$$ language plpgsql;
254+
255+
227256
## Mass check
228257

229258
You can use the plpgsql_check_function for mass check functions and mass check

plpgsql_check--2.1.sql

Lines changed: 0 additions & 258 deletions
This file was deleted.

plpgsql_check.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# plpgsql_check extension
22
comment = 'extended check for plpgsql functions'
3-
default_version = '2.1'
3+
default_version = '2.2'
44
module_pathname = '$libdir/plpgsql_check'
55
relocatable = false
66
requires = 'plpgsql'

postgresql10-plpgsql_check.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%global sname plpgsql_check
44

55
Name: %{sname}_%{pgmajorversion}
6-
Version: 2.1.10
6+
Version: 2.2.0
77
Release: 1%{?dist}
88
Summary: Additional tools for plpgsql functions validation
99

@@ -48,6 +48,9 @@ rm -rf %{buildroot}
4848
%{pginstdir}/share/extension/*.control
4949

5050
%changelog
51+
* Tue Sep 20 2022 - Pavel Stehule <pavel.stehule@gmail.com> 2.2.0
52+
- possibility to use in comment options
53+
5154
* Wed Dec 29 2021 - Pavel Stehule <pavel.stehule@gmail.com> 2.1.0
5255
- possibility to count statement's aborted execution
5356
- possibility to count "unfinished" statements due exception

postgresql11-plpgsql_check.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%global sname plpgsql_check
44

55
Name: %{sname}_%{pgmajorversion}
6-
Version: 2.1.10
6+
Version: 2.2.0
77
Release: 1%{?dist}
88
Summary: Additional tools for plpgsql functions validation
99

@@ -49,6 +49,9 @@ rm -rf %{buildroot}
4949
%{pginstdir}/share/extension/*.control
5050

5151
%changelog
52+
* Tue Sep 20 2022 - Pavel Stehule <pavel.stehule@gmail.com> 2.2.0
53+
- possibility to use in comment options
54+
5255
* Wed Dec 29 2021 - Pavel Stehule <pavel.stehule@gmail.com> 2.1.0
5356
- possibility to count statement's aborted execution
5457
- possibility to count "unfinished" statements due exception

postgresql12-plpgsql_check.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%global sname plpgsql_check
44

55
Name: %{sname}_%{pgmajorversion}
6-
Version: 2.1.10
6+
Version: 2.2.0
77
Release: 1%{?dist}
88
Summary: Additional tools for plpgsql functions validation
99

@@ -49,6 +49,9 @@ rm -rf %{buildroot}
4949
%{pginstdir}/share/extension/*.control
5050

5151
%changelog
52+
* Tue Sep 20 2022 - Pavel Stehule <pavel.stehule@gmail.com> 2.2.0
53+
- possibility to use in comment options
54+
5255
* Wed Dec 29 2021 - Pavel Stehule <pavel.stehule@gmail.com> 2.1.0
5356
- possibility to count statement's aborted execution
5457
- possibility to count "unfinished" statements due exception

0 commit comments

Comments
 (0)