Jump to: navigation, search

PostgreSQL QUOTE LITERAL

From w3cyberlearnings

Contents

Postgresql quote_literal

Properly embed single quote and backslashes are doubled to be used as a string literal in an SQL statement. If the argument expects a null, use quote_nullable().

Syntax quote_literal

quote_literal(value)

Example 1

test2=# SELECT quote_literal('\good\s.php');
  quote_literal   
------------------
 E'\\good\\s.php'
(1 row)

Example 2

postgres=# SELECT quote_literal(483.88);
 quote_literal 
---------------
 '483.88'
(1 row)

Example 3

postgres-# FROM employee;
 quote_literal 
---------------
 'John'
 'Week'
 'Christ'
(3 rows)

Related Links


Navigation
Web
SQL
MISC
References