summaryrefslogtreecommitdiff
path: root/doc/src/sgml/hstore.sgml
diff options
context:
space:
mode:
authorPeter Eisentraut2017-10-09 01:44:17 +0000
committerPeter Eisentraut2017-10-17 19:10:33 +0000
commitc29c578908dc0271eeb13a4014e54bff07a29c05 (patch)
tree1aa03fb6f1864719f2f23d4b0b9d5e2865764082 /doc/src/sgml/hstore.sgml
parent6ecabead4b5993c42745f2802d857b1a79f48bf9 (diff)
Don't use SGML empty tags
For DocBook XML compatibility, don't use SGML empty tags (</>) anymore, replace by the full tag name. Add a warning option to catch future occurrences. Alexander Lakhin, Jürgen Purtz
Diffstat (limited to 'doc/src/sgml/hstore.sgml')
-rw-r--r--doc/src/sgml/hstore.sgml152
1 files changed, 76 insertions, 76 deletions
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index db5d4409a6e..0264e4e532e 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -8,21 +8,21 @@
</indexterm>
<para>
- This module implements the <type>hstore</> data type for storing sets of
- key/value pairs within a single <productname>PostgreSQL</> value.
+ This module implements the <type>hstore</type> data type for storing sets of
+ key/value pairs within a single <productname>PostgreSQL</productname> value.
This can be useful in various scenarios, such as rows with many attributes
that are rarely examined, or semi-structured data. Keys and values are
simply text strings.
</para>
<sect2>
- <title><type>hstore</> External Representation</title>
+ <title><type>hstore</type> External Representation</title>
<para>
- The text representation of an <type>hstore</>, used for input and output,
- includes zero or more <replaceable>key</> <literal>=&gt;</>
- <replaceable>value</> pairs separated by commas. Some examples:
+ The text representation of an <type>hstore</type>, used for input and output,
+ includes zero or more <replaceable>key</replaceable> <literal>=&gt;</literal>
+ <replaceable>value</replaceable> pairs separated by commas. Some examples:
<synopsis>
k =&gt; v
@@ -31,15 +31,15 @@ foo =&gt; bar, baz =&gt; whatever
</synopsis>
The order of the pairs is not significant (and may not be reproduced on
- output). Whitespace between pairs or around the <literal>=&gt;</> sign is
+ output). Whitespace between pairs or around the <literal>=&gt;</literal> sign is
ignored. Double-quote keys and values that include whitespace, commas,
- <literal>=</>s or <literal>&gt;</>s. To include a double quote or a
+ <literal>=</literal>s or <literal>&gt;</literal>s. To include a double quote or a
backslash in a key or value, escape it with a backslash.
</para>
<para>
- Each key in an <type>hstore</> is unique. If you declare an <type>hstore</>
- with duplicate keys, only one will be stored in the <type>hstore</> and
+ Each key in an <type>hstore</type> is unique. If you declare an <type>hstore</type>
+ with duplicate keys, only one will be stored in the <type>hstore</type> and
there is no guarantee as to which will be kept:
<programlisting>
@@ -51,24 +51,24 @@ SELECT 'a=&gt;1,a=&gt;2'::hstore;
</para>
<para>
- A value (but not a key) can be an SQL <literal>NULL</>. For example:
+ A value (but not a key) can be an SQL <literal>NULL</literal>. For example:
<programlisting>
key =&gt; NULL
</programlisting>
- The <literal>NULL</> keyword is case-insensitive. Double-quote the
- <literal>NULL</> to treat it as the ordinary string <quote>NULL</quote>.
+ The <literal>NULL</literal> keyword is case-insensitive. Double-quote the
+ <literal>NULL</literal> to treat it as the ordinary string <quote>NULL</quote>.
</para>
<note>
<para>
- Keep in mind that the <type>hstore</> text format, when used for input,
- applies <emphasis>before</> any required quoting or escaping. If you are
- passing an <type>hstore</> literal via a parameter, then no additional
+ Keep in mind that the <type>hstore</type> text format, when used for input,
+ applies <emphasis>before</emphasis> any required quoting or escaping. If you are
+ passing an <type>hstore</type> literal via a parameter, then no additional
processing is needed. But if you're passing it as a quoted literal
constant, then any single-quote characters and (depending on the setting of
- the <varname>standard_conforming_strings</> configuration parameter)
+ the <varname>standard_conforming_strings</varname> configuration parameter)
backslash characters need to be escaped correctly. See
<xref linkend="sql-syntax-strings"> for more on the handling of string
constants.
@@ -83,7 +83,7 @@ key =&gt; NULL
</sect2>
<sect2>
- <title><type>hstore</> Operators and Functions</title>
+ <title><type>hstore</type> Operators and Functions</title>
<para>
The operators provided by the <literal>hstore</literal> module are
@@ -92,7 +92,7 @@ key =&gt; NULL
</para>
<table id="hstore-op-table">
- <title><type>hstore</> Operators</title>
+ <title><type>hstore</type> Operators</title>
<tgroup cols="4">
<thead>
@@ -106,99 +106,99 @@ key =&gt; NULL
<tbody>
<row>
- <entry><type>hstore</> <literal>-&gt;</> <type>text</></entry>
- <entry>get value for key (<literal>NULL</> if not present)</entry>
+ <entry><type>hstore</type> <literal>-&gt;</literal> <type>text</type></entry>
+ <entry>get value for key (<literal>NULL</literal> if not present)</entry>
<entry><literal>'a=&gt;x, b=&gt;y'::hstore -&gt; 'a'</literal></entry>
<entry><literal>x</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>-&gt;</> <type>text[]</></entry>
- <entry>get values for keys (<literal>NULL</> if not present)</entry>
+ <entry><type>hstore</type> <literal>-&gt;</literal> <type>text[]</type></entry>
+ <entry>get values for keys (<literal>NULL</literal> if not present)</entry>
<entry><literal>'a=&gt;x, b=&gt;y, c=&gt;z'::hstore -&gt; ARRAY['c','a']</literal></entry>
<entry><literal>{"z","x"}</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>||</> <type>hstore</></entry>
- <entry>concatenate <type>hstore</>s</entry>
+ <entry><type>hstore</type> <literal>||</literal> <type>hstore</type></entry>
+ <entry>concatenate <type>hstore</type>s</entry>
<entry><literal>'a=&gt;b, c=&gt;d'::hstore || 'c=&gt;x, d=&gt;q'::hstore</literal></entry>
<entry><literal>"a"=&gt;"b", "c"=&gt;"x", "d"=&gt;"q"</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>?</> <type>text</></entry>
- <entry>does <type>hstore</> contain key?</entry>
+ <entry><type>hstore</type> <literal>?</literal> <type>text</type></entry>
+ <entry>does <type>hstore</type> contain key?</entry>
<entry><literal>'a=&gt;1'::hstore ? 'a'</literal></entry>
<entry><literal>t</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>?&amp;</> <type>text[]</></entry>
- <entry>does <type>hstore</> contain all specified keys?</entry>
+ <entry><type>hstore</type> <literal>?&amp;</literal> <type>text[]</type></entry>
+ <entry>does <type>hstore</type> contain all specified keys?</entry>
<entry><literal>'a=&gt;1,b=&gt;2'::hstore ?&amp; ARRAY['a','b']</literal></entry>
<entry><literal>t</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>?|</> <type>text[]</></entry>
- <entry>does <type>hstore</> contain any of the specified keys?</entry>
+ <entry><type>hstore</type> <literal>?|</literal> <type>text[]</type></entry>
+ <entry>does <type>hstore</type> contain any of the specified keys?</entry>
<entry><literal>'a=&gt;1,b=&gt;2'::hstore ?| ARRAY['b','c']</literal></entry>
<entry><literal>t</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>@&gt;</> <type>hstore</></entry>
+ <entry><type>hstore</type> <literal>@&gt;</literal> <type>hstore</type></entry>
<entry>does left operand contain right?</entry>
<entry><literal>'a=&gt;b, b=&gt;1, c=&gt;NULL'::hstore @&gt; 'b=&gt;1'</literal></entry>
<entry><literal>t</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>&lt;@</> <type>hstore</></entry>
+ <entry><type>hstore</type> <literal>&lt;@</literal> <type>hstore</type></entry>
<entry>is left operand contained in right?</entry>
<entry><literal>'a=&gt;c'::hstore &lt;@ 'a=&gt;b, b=&gt;1, c=&gt;NULL'</literal></entry>
<entry><literal>f</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>-</> <type>text</></entry>
+ <entry><type>hstore</type> <literal>-</literal> <type>text</type></entry>
<entry>delete key from left operand</entry>
<entry><literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'b'::text</literal></entry>
<entry><literal>"a"=&gt;"1", "c"=&gt;"3"</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>-</> <type>text[]</></entry>
+ <entry><type>hstore</type> <literal>-</literal> <type>text[]</type></entry>
<entry>delete keys from left operand</entry>
<entry><literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - ARRAY['a','b']</literal></entry>
<entry><literal>"c"=&gt;"3"</literal></entry>
</row>
<row>
- <entry><type>hstore</> <literal>-</> <type>hstore</></entry>
+ <entry><type>hstore</type> <literal>-</literal> <type>hstore</type></entry>
<entry>delete matching pairs from left operand</entry>
<entry><literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'a=&gt;4, b=&gt;2'::hstore</literal></entry>
<entry><literal>"a"=&gt;"1", "c"=&gt;"3"</literal></entry>
</row>
<row>
- <entry><type>record</> <literal>#=</> <type>hstore</></entry>
- <entry>replace fields in <type>record</> with matching values from <type>hstore</></entry>
+ <entry><type>record</type> <literal>#=</literal> <type>hstore</type></entry>
+ <entry>replace fields in <type>record</type> with matching values from <type>hstore</type></entry>
<entry>see Examples section</entry>
<entry></entry>
</row>
<row>
- <entry><literal>%%</> <type>hstore</></entry>
- <entry>convert <type>hstore</> to array of alternating keys and values</entry>
+ <entry><literal>%%</literal> <type>hstore</type></entry>
+ <entry>convert <type>hstore</type> to array of alternating keys and values</entry>
<entry><literal>%% 'a=&gt;foo, b=&gt;bar'::hstore</literal></entry>
<entry><literal>{a,foo,b,bar}</literal></entry>
</row>
<row>
- <entry><literal>%#</> <type>hstore</></entry>
- <entry>convert <type>hstore</> to two-dimensional key/value array</entry>
+ <entry><literal>%#</literal> <type>hstore</type></entry>
+ <entry>convert <type>hstore</type> to two-dimensional key/value array</entry>
<entry><literal>%# 'a=&gt;foo, b=&gt;bar'::hstore</literal></entry>
<entry><literal>{{a,foo},{b,bar}}</literal></entry>
</row>
@@ -209,8 +209,8 @@ key =&gt; NULL
<note>
<para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@&gt;</>
- and <literal>&lt;@</> were called <literal>@</> and <literal>~</>,
+ Prior to PostgreSQL 8.2, the containment operators <literal>@&gt;</literal>
+ and <literal>&lt;@</literal> were called <literal>@</literal> and <literal>~</literal>,
respectively. These names are still available, but are deprecated and will
eventually be removed. Notice that the old names are reversed from the
convention formerly followed by the core geometric data types!
@@ -218,7 +218,7 @@ key =&gt; NULL
</note>
<table id="hstore-func-table">
- <title><type>hstore</> Functions</title>
+ <title><type>hstore</type> Functions</title>
<tgroup cols="5">
<thead>
@@ -235,7 +235,7 @@ key =&gt; NULL
<row>
<entry><function>hstore(record)</function><indexterm><primary>hstore</primary></indexterm></entry>
<entry><type>hstore</type></entry>
- <entry>construct an <type>hstore</> from a record or row</entry>
+ <entry>construct an <type>hstore</type> from a record or row</entry>
<entry><literal>hstore(ROW(1,2))</literal></entry>
<entry><literal>f1=&gt;1,f2=&gt;2</literal></entry>
</row>
@@ -243,7 +243,7 @@ key =&gt; NULL
<row>
<entry><function>hstore(text[])</function></entry>
<entry><type>hstore</type></entry>
- <entry>construct an <type>hstore</> from an array, which may be either
+ <entry>construct an <type>hstore</type> from an array, which may be either
a key/value array, or a two-dimensional array</entry>
<entry><literal>hstore(ARRAY['a','1','b','2']) || hstore(ARRAY[['c','3'],['d','4']])</literal></entry>
<entry><literal>a=&gt;1, b=&gt;2, c=&gt;3, d=&gt;4</literal></entry>
@@ -252,7 +252,7 @@ key =&gt; NULL
<row>
<entry><function>hstore(text[], text[])</function></entry>
<entry><type>hstore</type></entry>
- <entry>construct an <type>hstore</> from separate key and value arrays</entry>
+ <entry>construct an <type>hstore</type> from separate key and value arrays</entry>
<entry><literal>hstore(ARRAY['a','b'], ARRAY['1','2'])</literal></entry>
<entry><literal>"a"=&gt;"1","b"=&gt;"2"</literal></entry>
</row>
@@ -260,7 +260,7 @@ key =&gt; NULL
<row>
<entry><function>hstore(text, text)</function></entry>
<entry><type>hstore</type></entry>
- <entry>make single-item <type>hstore</></entry>
+ <entry>make single-item <type>hstore</type></entry>
<entry><literal>hstore('a', 'b')</literal></entry>
<entry><literal>"a"=&gt;"b"</literal></entry>
</row>
@@ -268,7 +268,7 @@ key =&gt; NULL
<row>
<entry><function>akeys(hstore)</function><indexterm><primary>akeys</primary></indexterm></entry>
<entry><type>text[]</type></entry>
- <entry>get <type>hstore</>'s keys as an array</entry>
+ <entry>get <type>hstore</type>'s keys as an array</entry>
<entry><literal>akeys('a=&gt;1,b=&gt;2')</literal></entry>
<entry><literal>{a,b}</literal></entry>
</row>
@@ -276,7 +276,7 @@ key =&gt; NULL
<row>
<entry><function>skeys(hstore)</function><indexterm><primary>skeys</primary></indexterm></entry>
<entry><type>setof text</type></entry>
- <entry>get <type>hstore</>'s keys as a set</entry>
+ <entry>get <type>hstore</type>'s keys as a set</entry>
<entry><literal>skeys('a=&gt;1,b=&gt;2')</literal></entry>
<entry>
<programlisting>
@@ -288,7 +288,7 @@ b
<row>
<entry><function>avals(hstore)</function><indexterm><primary>avals</primary></indexterm></entry>
<entry><type>text[]</type></entry>
- <entry>get <type>hstore</>'s values as an array</entry>
+ <entry>get <type>hstore</type>'s values as an array</entry>
<entry><literal>avals('a=&gt;1,b=&gt;2')</literal></entry>
<entry><literal>{1,2}</literal></entry>
</row>
@@ -296,7 +296,7 @@ b
<row>
<entry><function>svals(hstore)</function><indexterm><primary>svals</primary></indexterm></entry>
<entry><type>setof text</type></entry>
- <entry>get <type>hstore</>'s values as a set</entry>
+ <entry>get <type>hstore</type>'s values as a set</entry>
<entry><literal>svals('a=&gt;1,b=&gt;2')</literal></entry>
<entry>
<programlisting>
@@ -308,7 +308,7 @@ b
<row>
<entry><function>hstore_to_array(hstore)</function><indexterm><primary>hstore_to_array</primary></indexterm></entry>
<entry><type>text[]</type></entry>
- <entry>get <type>hstore</>'s keys and values as an array of alternating
+ <entry>get <type>hstore</type>'s keys and values as an array of alternating
keys and values</entry>
<entry><literal>hstore_to_array('a=&gt;1,b=&gt;2')</literal></entry>
<entry><literal>{a,1,b,2}</literal></entry>
@@ -317,7 +317,7 @@ b
<row>
<entry><function>hstore_to_matrix(hstore)</function><indexterm><primary>hstore_to_matrix</primary></indexterm></entry>
<entry><type>text[]</type></entry>
- <entry>get <type>hstore</>'s keys and values as a two-dimensional array</entry>
+ <entry>get <type>hstore</type>'s keys and values as a two-dimensional array</entry>
<entry><literal>hstore_to_matrix('a=&gt;1,b=&gt;2')</literal></entry>
<entry><literal>{{a,1},{b,2}}</literal></entry>
</row>
@@ -359,7 +359,7 @@ b
<row>
<entry><function>slice(hstore, text[])</function><indexterm><primary>slice</primary></indexterm></entry>
<entry><type>hstore</type></entry>
- <entry>extract a subset of an <type>hstore</></entry>
+ <entry>extract a subset of an <type>hstore</type></entry>
<entry><literal>slice('a=&gt;1,b=&gt;2,c=&gt;3'::hstore, ARRAY['b','c','x'])</literal></entry>
<entry><literal>"b"=&gt;"2", "c"=&gt;"3"</literal></entry>
</row>
@@ -367,7 +367,7 @@ b
<row>
<entry><function>each(hstore)</function><indexterm><primary>each</primary></indexterm></entry>
<entry><type>setof(key text, value text)</type></entry>
- <entry>get <type>hstore</>'s keys and values as a set</entry>
+ <entry>get <type>hstore</type>'s keys and values as a set</entry>
<entry><literal>select * from each('a=&gt;1,b=&gt;2')</literal></entry>
<entry>
<programlisting>
@@ -381,7 +381,7 @@ b
<row>
<entry><function>exist(hstore,text)</function><indexterm><primary>exist</primary></indexterm></entry>
<entry><type>boolean</type></entry>
- <entry>does <type>hstore</> contain key?</entry>
+ <entry>does <type>hstore</type> contain key?</entry>
<entry><literal>exist('a=&gt;1','a')</literal></entry>
<entry><literal>t</literal></entry>
</row>
@@ -389,7 +389,7 @@ b
<row>
<entry><function>defined(hstore,text)</function><indexterm><primary>defined</primary></indexterm></entry>
<entry><type>boolean</type></entry>
- <entry>does <type>hstore</> contain non-<literal>NULL</> value for key?</entry>
+ <entry>does <type>hstore</type> contain non-<literal>NULL</literal> value for key?</entry>
<entry><literal>defined('a=&gt;NULL','a')</literal></entry>
<entry><literal>f</literal></entry>
</row>
@@ -421,7 +421,7 @@ b
<row>
<entry><function>populate_record(record,hstore)</function><indexterm><primary>populate_record</primary></indexterm></entry>
<entry><type>record</type></entry>
- <entry>replace fields in <type>record</> with matching values from <type>hstore</></entry>
+ <entry>replace fields in <type>record</type> with matching values from <type>hstore</type></entry>
<entry>see Examples section</entry>
<entry></entry>
</row>
@@ -442,7 +442,7 @@ b
<note>
<para>
The function <function>populate_record</function> is actually declared
- with <type>anyelement</>, not <type>record</>, as its first argument,
+ with <type>anyelement</type>, not <type>record</type>, as its first argument,
but it will reject non-record types with a run-time error.
</para>
</note>
@@ -452,8 +452,8 @@ b
<title>Indexes</title>
<para>
- <type>hstore</> has GiST and GIN index support for the <literal>@&gt;</>,
- <literal>?</>, <literal>?&amp;</> and <literal>?|</> operators. For example:
+ <type>hstore</type> has GiST and GIN index support for the <literal>@&gt;</literal>,
+ <literal>?</literal>, <literal>?&amp;</literal> and <literal>?|</literal> operators. For example:
</para>
<programlisting>
CREATE INDEX hidx ON testhstore USING GIST (h);
@@ -462,12 +462,12 @@ CREATE INDEX hidx ON testhstore USING GIN (h);
</programlisting>
<para>
- <type>hstore</> also supports <type>btree</> or <type>hash</> indexes for
- the <literal>=</> operator. This allows <type>hstore</> columns to be
- declared <literal>UNIQUE</>, or to be used in <literal>GROUP BY</>,
- <literal>ORDER BY</> or <literal>DISTINCT</> expressions. The sort ordering
- for <type>hstore</> values is not particularly useful, but these indexes
- may be useful for equivalence lookups. Create indexes for <literal>=</>
+ <type>hstore</type> also supports <type>btree</type> or <type>hash</type> indexes for
+ the <literal>=</literal> operator. This allows <type>hstore</type> columns to be
+ declared <literal>UNIQUE</literal>, or to be used in <literal>GROUP BY</literal>,
+ <literal>ORDER BY</literal> or <literal>DISTINCT</literal> expressions. The sort ordering
+ for <type>hstore</type> values is not particularly useful, but these indexes
+ may be useful for equivalence lookups. Create indexes for <literal>=</literal>
comparisons as follows:
</para>
<programlisting>
@@ -495,7 +495,7 @@ UPDATE tab SET h = delete(h, 'k1');
</para>
<para>
- Convert a <type>record</> to an <type>hstore</>:
+ Convert a <type>record</type> to an <type>hstore</type>:
<programlisting>
CREATE TABLE test (col1 integer, col2 text, col3 text);
INSERT INTO test VALUES (123, 'foo', 'bar');
@@ -509,7 +509,7 @@ SELECT hstore(t) FROM test AS t;
</para>
<para>
- Convert an <type>hstore</> to a predefined <type>record</> type:
+ Convert an <type>hstore</type> to a predefined <type>record</type> type:
<programlisting>
CREATE TABLE test (col1 integer, col2 text, col3 text);
@@ -523,7 +523,7 @@ SELECT * FROM populate_record(null::test,
</para>
<para>
- Modify an existing record using the values from an <type>hstore</>:
+ Modify an existing record using the values from an <type>hstore</type>:
<programlisting>
CREATE TABLE test (col1 integer, col2 text, col3 text);
INSERT INTO test VALUES (123, 'foo', 'bar');
@@ -541,7 +541,7 @@ SELECT (r).* FROM (SELECT t #= '"col3"=&gt;"baz"' AS r FROM test t) s;
<title>Statistics</title>
<para>
- The <type>hstore</> type, because of its intrinsic liberality, could
+ The <type>hstore</type> type, because of its intrinsic liberality, could
contain a lot of different keys. Checking for valid keys is the task of the
application. The following examples demonstrate several techniques for
checking keys and obtaining statistics.
@@ -588,7 +588,7 @@ SELECT key, count(*) FROM
<title>Compatibility</title>
<para>
- As of PostgreSQL 9.0, <type>hstore</> uses a different internal
+ As of PostgreSQL 9.0, <type>hstore</type> uses a different internal
representation than previous versions. This presents no obstacle for
dump/restore upgrades since the text representation (used in the dump) is
unchanged.
@@ -599,7 +599,7 @@ SELECT key, count(*) FROM
having the new code recognize old-format data. This will entail a slight
performance penalty when processing data that has not yet been modified by
the new code. It is possible to force an upgrade of all values in a table
- column by doing an <literal>UPDATE</> statement as follows:
+ column by doing an <literal>UPDATE</literal> statement as follows:
<programlisting>
UPDATE tablename SET hstorecol = hstorecol || '';
</programlisting>
@@ -610,7 +610,7 @@ UPDATE tablename SET hstorecol = hstorecol || '';
<programlisting>
ALTER TABLE tablename ALTER hstorecol TYPE hstore USING hstorecol || '';
</programlisting>
- The <command>ALTER TABLE</> method requires an exclusive lock on the table,
+ The <command>ALTER TABLE</command> method requires an exclusive lock on the table,
but does not result in bloating the table with old row versions.
</para>