DECOMPOSE

DECOMPOSE in SQL is a function utilized to split a composite column into its component elements. It is commonly used in operations involving multicolumn keys or records.

Example

DO $$
DECLARE
uname name;
BEGIN
uname := DECOMPOSE('n\u0303');
RAISE NOTICE 'Decomposed String: %', uname;
END $$;

Output

NOTICE: Decomposed String: ñ

Explanation

The provided SQL script uses PostgreSQL’s DO language to declare a variable and assign to it the decomposed Unicode string. In the BEGIN block, the predefined DECOMPOSE function is used to split the character ‘ñ’ into its constituent parts: ‘n’ and the combining tilde ‘̃’. The result is then displayed with the RAISE NOTICE command. The output shows the decomposed string.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.