Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5405917

Browse files
authored
renames
1 parent 3b4211e commit 5405917

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎dba/DDL_log_to_table/DDL_log_to_table_2_functions.do.sql‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
--Выполнять под суперпользователем postgres!
44

5-
create or replace function db_audit.grep_inet(str text)
5+
create or replace function db_audit.grep_ip(str text)
66
returns table (order_num int, "all" text, addr inet, port int, mask int)
77
stable
88
returns null on null input
@@ -18,7 +18,7 @@ as $func$
1818
$$
1919
( #1 all
2020
(?<![\d.:/]) #boundary
21-
(\d{1,3}) \. (\d{1,3}) \. (\d{1,3}) \. (\d{1,3}) #2-5 addr 1..255
21+
(\d{1,3}) \. (\d{1,3}) \. (\d{1,3}) \. (\d{1,3}) #2-5 addr 0..255
2222
(?:
2323
: (\d{1,5}) #6 port 1..65535
2424
| / (\d{1,2}) #7 mask 0..32
@@ -28,12 +28,12 @@ as $func$
2828
$,ドル 'xg') as t(m)
2929
where not exists(select
3030
from unnest(m[2:5]) u(e)
31-
where e::int not between 0and 255)
31+
where e::int > 255)
3232
and (m[6] is null or m[6]::int between 1 and 65535)
33-
and (m[7] is null or m[7]::int between 0and32);
33+
and (m[7] is null or m[7]::int <33);
3434
$func$;
3535

36-
comment on function db_audit.grep_inet(str text) is $$
36+
comment on function db_audit.grep_ip(str text) is $$
3737
Захватывает из строки все существующие IP адреса.
3838
IP адрес может иметь необязательный порт или маску.
3939
$$;
@@ -102,7 +102,7 @@ declare
102102
begin
103103
--positive and negative both
104104
assert (select json_agg(to_json(t))::text = str_out
105-
from db_audit.grep_inet(str_in) as t);
105+
from db_audit.grep_ip(str_in) as t);
106106
end;
107107
$do$;
108108

@@ -134,7 +134,7 @@ BEGIN
134134

135135
select t.addr, t.port, true, nullif(rtrim(replace(app_name, t."all", ''), E'-, \r\n\t'), '')
136136
into addr, port, via_proxy, app_name
137-
from db_audit.grep_inet(app_name) as t
137+
from db_audit.grep_ip(app_name) as t
138138
where t.port is not null
139139
order by t.order_num desc
140140
limit 1;
@@ -181,7 +181,7 @@ BEGIN
181181

182182
select t.addr, t.port, true, nullif(rtrim(replace(app_name, t."all", ''), E'-, \r\n\t'), '')
183183
into addr, port, via_proxy, app_name
184-
from db_audit.grep_inet(app_name) as t
184+
from db_audit.grep_ip(app_name) as t
185185
where t.port is not null
186186
order by t.order_num desc
187187
limit 1;
@@ -260,7 +260,7 @@ BEGIN
260260

261261
select t.addr, t.port, true, nullif(rtrim(replace(app_name, t."all", ''), E'-, \r\n\t'), '')
262262
into addr, port, via_proxy, app_name
263-
from db_audit.grep_inet(app_name) as t
263+
from db_audit.grep_ip(app_name) as t
264264
where t.port is not null
265265
order by t.order_num desc
266266
limit 1;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /