File tree 1 file changed +5
-8
lines changed
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
1
-- see also extension https://github.com/okbob/url_encode with C implementation
2
2
3
- create or replace function url_encode (text )
3
+ create or replace function public . url_encode(text )
4
4
returns text
5
5
immutable
6
- strict
6
+ strict -- returns null if any parameter is null
7
7
language sql
8
8
set search_path = ' '
9
9
as $$
@@ -16,16 +16,13 @@ select
16
16
end,
17
17
' '
18
18
)
19
- from (
20
- select char
21
- -- from regexp_split_to_table($1, '') as ch
22
- from unnest(string_to_array($1 , null )) as char
23
- ) as s;
19
+ from -- regexp_split_to_table($1, '') as s(char) --deprecated
20
+ unnest(string_to_array($1 , null )) as s(char );
24
21
$$;
25
22
26
23
-- TEST
27
24
do $$
28
25
begin
29
- assert urlencode (' hello, привет!' ) = ' hello%2C%20%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82%21' ;
26
+ assert public . url_encode (' hello, привет!' ) = ' hello%2C%20%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82%21' ;
30
27
end;
31
28
$$;
You can’t perform that action at this time.
0 commit comments