<acronym>SQL</acronym> standard. Some of the extended functionality
is present in other <acronym>SQL</acronym> database management
systems, and in many cases this functionality is compatible and
- consistent between the various implementations.
+ consistent between the various implementations. This chapter is also
+ not exhaustive; additional functions appear in relevant sections of
+ the manual.
</para>
<row>
<entry><literal><function>strpos</function>(<parameter>string</parameter>, <parameter>substring</parameter>)</literal></entry>
- <entry><type>text</type></entry>
+ <entry><type>int</type></entry>
<entry>
Location of specified substring (same as
<literal>position(<parameter>substring</parameter> in
</para>
</listitem>
+ <listitem>
+ <para>
+ In conversions from string to <type>timestamp</type> or
+ <type>date</type>, the <literal>CC</literal> field is ignored if there
+ is a <literal>YYY</literal>, <literal>YYYY</literal> or
+ <literal>Y,YYY</literal> field. If <literal>CC</literal> is used with
+ <literal>YY</literal> or <literal>Y</literal> then the year is computed
+ as <literal>(CC-1)*100+YY</literal>.
+ </para>
+ </listitem>
+
<listitem>
<para>
Millisecond (<literal>MS</literal>) and microsecond (<literal>US</literal>)
week starts on Monday.) In other words, the first Thursday of
a year is in week 1 of that year. (for <type>timestamp</type> values only)
</para>
+ <para>
+ Because of this, it is possible for early January dates to be part of the
+ 52nd or 53rd week of the previous year. For example, <literal>2005-01-01</>
+ is part of the 53rd week of year 2004, and <literal>2006-01-01</> is part of
+ the 52nd week of year 2005.
+ </para>
<screen>
SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16 20:38:40');
<row>
<entry> <literal>>^</literal> </entry>
<entry>Is above?</entry>
- <entry><literal>circle '((0,5),1)' >^ circle '((0,0),1)'</literal></entry>
+ <entry><literal>circle '((0,5),1)' >^ circle '((0,0),1)'</literal></entry>
</row>
<row>
<entry> <literal>?#</literal> </entry>
<row>
<entry><literal><function>circle</function>(<type>point</type>, <type>double precision</type>)</literal></entry>
<entry><type>circle</type></entry>
- <entry>point and radius to circle</entry>
+ <entry>center and radius to circle</entry>
<entry><literal>circle(point '(0,0)', 2.0)</literal></entry>
</row>
<row>
<entry>polygon to path</entry>
<entry><literal>path(polygon '((0,0),(1,1),(2,0))')</literal></entry>
</row>
+ <row>
+ <entry><literal><function>point</function>(<type>double
+ precision</type>, <type>double precision</type>)</literal></entry>
+ <entry><type>point</type></entry>
+ <entry>construct point</entry>
+ <entry><literal>point(23.4, -44.5)</literal></entry>
+ </row>
+ <row>
+ <entry><literal><function>point</function>(<type>box</type>)</literal></entry>
+ <entry><type>point</type></entry>
+ <entry>center of box</entry>
+ <entry><literal>point(box '((-1,0),(1,0))')</literal></entry>
+ </row>
<row>
<entry><literal><function>point</function>(<type>circle</type>)</literal></entry>
<entry><type>point</type></entry>
<entry>center of circle</entry>
<entry><literal>point(circle '((0,0),2.0)')</literal></entry>
</row>
+ <row>
+ <entry><literal><function>point</function>(<type>lseg</type>)</literal></entry>
+ <entry><type>point</type></entry>
+ <entry>center of lseg</entry>
+ <entry><literal>point(lseg '((-1,0),(1,0))')</literal></entry>
+ </row>
<row>
<entry><literal><function>point</function>(<type>lseg</type>, <type>lseg</type>)</literal></entry>
<entry><type>point</type></entry>
this way — if the name can be recognized at all, it must be visible.
</para>
+ <indexterm zone="functions-info">
+ <primary>format_type</primary>
+ </indexterm>
+
<indexterm zone="functions-info">
<primary>pg_get_viewdef</primary>
</indexterm>
</thead>
<tbody>
+ <row>
+ <entry><literal><function>format_type</function>(<parameter>type_oid</parameter>, <parameter>typemod</>)</literal></entry>
+ <entry><type>text</type></entry>
+ <entry>get SQL name of a data type</entry>
+ </row>
<row>
<entry><literal><function>pg_get_viewdef</function>(<parameter>view_name</parameter>)</literal></entry>
<entry><type>text</type></entry>
</tgroup>
</table>
+ <para>
+ <function>format_type</function> returns the SQL name of a data type that
+ is identified by its type OID and possibly a type modifier. Pass NULL
+ for the type modifier if no specific modifier is known.
+ </para>
+
<para>
<function>pg_get_viewdef</function>,
<function>pg_get_ruledef</function>,