summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2007-11-27 16:46:36 +0000
committerBruce Momjian <bruce@momjian.us>2007-11-27 16:46:36 +0000
commita0a9c5bcb9a0bc608be94b305ab1451c591ab0bf (patch)
treee8e7a36459b129309fa2070b80d8337d041fbaf7 /doc/src
parent7888b52076562ba770ccfd863dc3c3c984788703 (diff)
Add example of MONEY casting to numeric if locale is known.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/datatype.sgml12
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 29360539696..699884d8003 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.219 2007/11/27 06:05:57 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.220 2007/11/27 16:46:36 momjian Exp $ -->
<chapter id="datatype">
<title id="datatype-title">Data Types</title>
@@ -848,8 +848,14 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
<programlisting>
SELECT 1234::text::money;
</programlisting>
- There is no simple way of doing the reverse using a locale-neutral
- method, namely casting a <type>money</type> value to a numeric type.
+ There is no simple way of doing the reverse in a locale-independent
+ manner, namely casting a <type>money</type> value to a numeric type.
+ If you know the currency symbol and thousands separator you can use
+ <function>regexp_replace()</>:
+<programlisting>
+SELECT regexp_replace('52093.89'::money::text, '[$,]', '', 'g')::numeric;
+</programlisting>
+
</para>
<para>