UNQUOTE()

Overview

Returns a string with removed surrounding quotes and removed backslash escapes.

USAGE

UNQUOTE(string)

Argument Name

Description

string

The string to unquote

DETAILS

UNQUOTE() is a string function that returns a string with removed surrounding quotation marks and removed backslash escapes.

The input argument can be surrounded by either single quotes or double quotes. If the starting character and ending character are not a single/double quote or they don't match, the string is returned unchanged.

When quotes are removed, the return value is also modified to remove backslash escaping: the way to get a backslash in the result is for the input to contain 2 backslash characters in a row.

Certain improperly escaped inputs might return an unexpected output, such as a 1-character string of a quote turning into an empty string. However, properly encoded quoted strings always return a properly unquoted string.

For the reverse operation, see QUOTE().

A NULL is returned if the argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SET @chk = '"testing \\"one two\\"!"';
SELECT @chk, UNQUOTE(@chk)\G
*************************** 1. row ***************************
         @chk: "testing \"one two\"!"
UNQUOTE(@chk): testing "one two"!
SET @chk = QUOTE('I \\ can\'t \\ decide.');
SELECT @chk, UNQUOTE(@chk)\G
*************************** 1. row ***************************
         @chk: 'I \\ can\'t \\ decide.'
UNQUOTE(@chk): I \ can't \ decide.
SET @chk = '"hi\'';
SELECT @chk, UNQUOTE(@chk)\G
*************************** 1. row ***************************
         @chk: "hi'
UNQUOTE(@chk): "hi'
SELECT UNQUOTE('"'), UNQUOTE('"\\"');
+--------------+-----------------+
| UNQUOTE('"') | UNQUOTE('"\\"') |
+--------------+-----------------+
|              |                 |
+--------------+-----------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Added in MariaDB Xpand 5.3.14.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Added in MariaDB Xpand 5.3.14.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES