URL functions#
Extraction functions#
The URL extraction functions extract components from HTTP URLs (or any valid URIs conforming to RFC 2396). The following syntax is supported:
[protocol:][//host[:port]][path][?query][#fragment]
The extracted components do not contain URI syntax separators
such as : or ?.
- url_extract_parameter(url, name) varchar#
Returns the value of the first query string parameter named
namefromurl. Parameter extraction is handled in the typical manner as specified by RFC 1866 Section 8.2.1.
- url_extract_protocol(url) varchar#
Returns the protocol from
url:SELECT url_extract_protocol('http://localhost:8080/req_path'); -- http SELECT url_extract_protocol('https://127.0.0.1:8080/req_path'); -- https SELECT url_extract_protocol('ftp://path/file'); -- ftp
Encoding functions#
- url_encode(value) varchar#
Escapes
valueby encoding it so that it can be safely included in URL query parameter names and values:Alphanumeric characters are not encoded.
The characters
.,-,*and_are not encoded.The ASCII space character is encoded as
+.All other characters are converted to UTF-8 and the bytes are encoded as the string
%XXwhereXXis the uppercase hexadecimal value of the UTF-8 byte.
- url_decode(value) varchar#
Unescapes the URL encoded
value. This function is the inverse ofurl_encode().