summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-11-27 18:29:11 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-11-27 18:29:11 +0000
commit3f899642340a9f5de946af50152a529aac5e57bb (patch)
treeef5406086d26d7400e2731b7f05b1b2b84fa70bb /doc/src
parent66d7bbf6746adb00b859c7ffc7c55ad96b18e29a (diff)
Add quote_literal(anyelement) to preserve (and, in fact, extend) a
useful consequence of the former liberal implicit casting to text; namely that you can feed non-string values to quote_literal() and get unsurprising results. Per discussion.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml17
1 files changed, 14 insertions, 3 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 24b1931caea..a3baee14489 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.411 2007/11/08 13:13:28 petere Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.412 2007/11/27 18:29:11 tgl Exp $ -->
<chapter id="functions">
<title>Functions and Operators</title>
@@ -1514,7 +1514,7 @@
</row>
<row>
- <entry><literal><function>quote_ident</function>(<parameter>string</parameter>)</literal></entry>
+ <entry><literal><function>quote_ident</function>(<parameter>string</parameter> <type>text</type>)</literal></entry>
<entry><type>text</type></entry>
<entry>
Return the given string suitably quoted to be used as an identifier
@@ -1528,7 +1528,7 @@
</row>
<row>
- <entry><literal><function>quote_literal</function>(<parameter>string</parameter>)</literal></entry>
+ <entry><literal><function>quote_literal</function>(<parameter>string</parameter> <type>text</type>)</literal></entry>
<entry><type>text</type></entry>
<entry>
Return the given string suitably quoted to be used as a string literal
@@ -1540,6 +1540,17 @@
</row>
<row>
+ <entry><literal><function>quote_literal</function>(<parameter>value</parameter> <type>anyelement</type>)</literal></entry>
+ <entry><type>text</type></entry>
+ <entry>
+ Coerce the given value to text and then quote it as a literal.
+ Embedded single-quotes and backslashes are properly doubled.
+ </entry>
+ <entry><literal>quote_literal(42.5)</literal></entry>
+ <entry><literal>'42.5'</literal></entry>
+ </row>
+
+ <row>
<entry><literal><function>regexp_matches</function>(<parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter> <type>text</type> [, <parameter>flags</parameter> <type>text</type>])</literal></entry>
<entry><type>setof text[]</type></entry>
<entry>