Commit 61737a7b authored by Peter Eisentraut's avatar Peter Eisentraut

Add some links from data type chapter to section on literal constants.

parent 6434ce65
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.47 2001/01/13 18:34:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.48 2001/01/26 22:04:22 petere Exp $
--> -->
<chapter id="datatype"> <chapter id="datatype">
...@@ -335,8 +335,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.47 2001/01/13 18:34:51 pe ...@@ -335,8 +335,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.47 2001/01/13 18:34:51 pe
</para> </para>
<para> <para>
The numeric types have a full set of corresponding arithmetic operators and The syntax of constants for the numeric types is described in
functions. Refer to <xref linkend="functions"> for more information. <xref linkend="sql-syntax-constants">. The numeric types have a
full set of corresponding arithmetic operators and
functions. Refer to <xref linkend="functions"> for more
information.
</para> </para>
<para> <para>
...@@ -362,7 +365,7 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -362,7 +365,7 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
<programlisting> <programlisting>
CREATE SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq; CREATE SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq;
CREATE TABLE <replaceable class="parameter">tablename</replaceable> CREATE TABLE <replaceable class="parameter">tablename</replaceable>
(<replaceable class="parameter">colname</replaceable> INT4 DEFAULT nextval('<replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq'); (<replaceable class="parameter">colname</replaceable> integer DEFAULT nextval('<replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq');
CREATE UNIQUE INDEX <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_key on <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable>); CREATE UNIQUE INDEX <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_key on <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable>);
</programlisting> </programlisting>
...@@ -394,20 +397,29 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -394,20 +397,29 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
<title>Monetary Type</title> <title>Monetary Type</title>
<note> <note>
<title>Obsolete Type</title> <title>Deprecated</title>
<para> <para>
The <type>money</type> is now deprecated. Use <type>numeric</type> The <type>money</type> is now deprecated. Use
or <type>decimal</type> instead. The money type may become a <type>numeric</type> or <type>decimal</type> instead, in
locale-aware layer over the numeric type in a future release. combination with the <function>to_char</function> function. The
money type may become a locale-aware layer over the
<type>numeric</type> type in a future release.
</para> </para>
</note> </note>
<para> <para>
The <type>money</type> type supports US-style currency with The <type>money</type> type stores U.S.-style currency with fixed
fixed decimal point representation. decimal point representation. If
If <productname>Postgres</productname> is compiled with USE_LOCALE <productname>Postgres</productname> is compiled with locale
then the money type should use the monetary conventions defined for support then the <type>money</type> type uses locale-specific
<citetitle>locale(7)</citetitle>. output formatting.
</para>
<para>
Input is accepted in a variety of formats, including integer and
floating point literals, as well as <quote>typical</quote>
currency formatting, such as <literal>'$1,000.00'</literal>.
Output is in the latter form.
</para> </para>
<para> <para>
...@@ -434,14 +446,9 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -434,14 +446,9 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
</tgroup> </tgroup>
</table> </table>
</para> </para>
<para>
<type>numeric</type>
will replace the money type, and should be preferred.
</para>
</sect1> </sect1>
<sect1 id="datatype-character"> <sect1 id="datatype-character">
<title>Character Types</title> <title>Character Types</title>
...@@ -455,6 +462,12 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -455,6 +462,12 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
limit on the size of the field. limit on the size of the field.
</para> </para>
<para>
Refer to <xref linkend="sql-syntax-strings"> for information about
the syntax of string literals, and to <xref linkend="functions">
for information about available operators and functions.
</para>
<para> <para>
<table tocentry="1"> <table tocentry="1">
<title><productname>Postgres</productname> Character Types</title> <title><productname>Postgres</productname> Character Types</title>
...@@ -661,8 +674,14 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -661,8 +674,14 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
</para> </para>
<para> <para>
Remember that any date or time input needs to be enclosed into single quotes, Remember that any date or time input needs to be enclosed into
like text strings. single quotes, like text strings. Refer to <xref
linkend="sql-syntax-constants-generic"> for more information.
SQL requires the following syntax
<synopsis>
<replaceable>type</replaceable> '<replaceable>value</replaceable>'
</synopsis>
but <productname>Postgres</productname> is more flexible.
</para> </para>
<sect3> <sect3>
...@@ -1393,20 +1412,20 @@ January 8 04:05:06 1999 PST ...@@ -1393,20 +1412,20 @@ January 8 04:05:06 1999 PST
<thead> <thead>
<row> <row>
<entry>State</entry> <entry>State</entry>
<entry>Output</entry>
<entry>Input</entry> <entry>Input</entry>
<entry>Output</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>True</entry> <entry>True</entry>
<entry>'t'</entry>
<entry>TRUE, 't', 'true', 'y', 'yes', '1'</entry> <entry>TRUE, 't', 'true', 'y', 'yes', '1'</entry>
<entry><literal>t</literal></entry>
</row> </row>
<row> <row>
<entry>False</entry> <entry>False</entry>
<entry>'f'</entry>
<entry>FALSE, 'f', 'false', 'n', 'no', '0'</entry> <entry>FALSE, 'f', 'false', 'n', 'no', '0'</entry>
<entry><literal>f</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.37 2001/01/22 23:34:33 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.38 2001/01/26 22:04:22 petere Exp $
--> -->
<chapter id="sql-syntax"> <chapter id="sql-syntax">
...@@ -304,7 +304,7 @@ REAL '1.23' -- string style ...@@ -304,7 +304,7 @@ REAL '1.23' -- string style
</para> </para>
</sect3> </sect3>
<sect3> <sect3 id="sql-syntax-constants-generic">
<title>Constants of Other Types</title> <title>Constants of Other Types</title>
<para> <para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment