aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-07-11 13:59:35 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-07-11 13:59:35 -0400
commit84a42560c82aeb9f3690d93a0d03cf544f53b89b (patch)
tree77ea56d8deb643a1f7b9955e8226069c342942c4 /doc/src
parentf9951252dbd86391ab3a9bcba99f4e9f13e311a6 (diff)
downloadpostgresql-84a42560c82aeb9f3690d93a0d03cf544f53b89b.tar.gz
postgresql-84a42560c82aeb9f3690d93a0d03cf544f53b89b.zip
Add array_remove() and array_replace() functions.
These functions support removing or replacing array element value(s) matching a given search value. Although intended mainly to support a future array-foreign-key feature, they seem useful in their own right. Marco Nenciarini and Gabriele Bartolini, reviewed by Alex Hunsaker
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 4f539428e28..157de09b4ea 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -10317,6 +10317,12 @@ SELECT NULLIF(value, '(none)') ...
<primary>array_prepend</primary>
</indexterm>
<indexterm>
+ <primary>array_remove</primary>
+ </indexterm>
+ <indexterm>
+ <primary>array_replace</primary>
+ </indexterm>
+ <indexterm>
<primary>array_to_string</primary>
</indexterm>
<indexterm>
@@ -10435,6 +10441,29 @@ SELECT NULLIF(value, '(none)') ...
<row>
<entry>
<literal>
+ <function>array_remove</function>(<type>anyarray</type>, <type>anyelement</type>)
+ </literal>
+ </entry>
+ <entry><type>anyarray</type></entry>
+ <entry>remove all elements equal to the given value from the array
+ (array must be one-dimensional)</entry>
+ <entry><literal>array_remove(ARRAY[1,2,3,2], 2)</literal></entry>
+ <entry><literal>{1,3}</literal></entry>
+ </row>
+ <row>
+ <entry>
+ <literal>
+ <function>array_replace</function>(<type>anyarray</type>, <type>anyelement</type>, <type>anyelement</type>)
+ </literal>
+ </entry>
+ <entry><type>anyarray</type></entry>
+ <entry>replace each array element equal to the given value with a new value</entry>
+ <entry><literal>array_replace(ARRAY[1,2,5,4], 5, 3)</literal></entry>
+ <entry><literal>{1,2,3,4}</literal></entry>
+ </row>
+ <row>
+ <entry>
+ <literal>
<function>array_to_string</function>(<type>anyarray</type>, <type>text</type> <optional>, <type>text</type></optional>)
</literal>
</entry>