You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2007/10/12 16:57:50 UTC

svn commit: r584173 - in /db/derby/docs/trunk/src/ref: rrefsqlj30540.dita rrefsqlj81859.dita

Author: dag
Date: Fri Oct 12 07:57:50 2007
New Revision: 584173

URL: http://svn.apache.org/viewvc?rev=584173&view=rev
Log:
DERBY-3010 WITH DEFAULT value documentation needs improvement

Patch DERBY-3010-2, contributed by Kim with input from Dag.

Modified:
    db/derby/docs/trunk/src/ref/rrefsqlj30540.dita
    db/derby/docs/trunk/src/ref/rrefsqlj81859.dita

Modified: db/derby/docs/trunk/src/ref/rrefsqlj30540.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj30540.dita?rev=584173&r1=584172&r2=584173&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj30540.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj30540.dita Fri Oct 12 07:57:50 2007
@@ -22,17 +22,45 @@
 <refbody>
 <example> <codeblock><b><i><xref href="rrefsimplecolumnname.dita#rrefsimplecolumnname">Simple-column-Name</xref></i> <i>DataType</i>
     [ <i><xref href="rrefsqlj16095.dita#rrefsqlj16095">Column-level-constraint</xref></i> ]*
-    [ [ WITH ] DEFAULT { ConstantExpression | NULL }
+    [ [ WITH ] DEFAULT <varname>DefaultConstantExpression</varname>
        |<i><xref href="rrefsqlj37836.dita#rrefsqlj37836">generated-column-spec</xref></i> ]
     [ <i><xref href="rrefsqlj16095.dita#rrefsqlj16095">Column-level-constraint</xref></i> ]*
 </b></codeblock></example>
-<section><p>The syntax of <i>Data-Type</i> is described in <xref href="crefsqlj31068.dita#crefsqlj31068"></xref>.</p><p>The
+<section><p>The syntax of <i>DataType</i> is described in <xref href="crefsqlj31068.dita#crefsqlj31068"></xref>.</p><p>The
 syntaxes of <i><xref href="rrefsqlj16095.dita#rrefsqlj16095">Column-level-constraint</xref></i> and <i><xref
 href="rrefsqlj42154.dita#rrefsqlj42154">Table-level constraint</xref></i> are described in <xref
 href="rrefsqlj13590.dita#rrefsqlj13590"></xref>.</p></section>
 <section id="sqlj64478"><title>Column default</title><p>For the definition
-of a default value, a <i>ConstantExpression</i> is an expression that does
-not refer to any table. It can include constants, date-time special registers,
-current schemas, users, and null.</p> </section>
+of a default value, a <varname>DefaultConstantExpression</varname> is an 
+expression that does not refer to any table. It can include constants, 
+date-time special registers, current schemas, users, and null: </p>
+<codeblock><b><varname>DefaultConstantExpression</varname>:
+          NULL
+        | CURRENT { SCHEMA | SQLID }
+        | USER | CURRENT_USER | SESSION_USER
+        | DATE
+        | TIME
+        | TIMESTAMP
+        | CURRENT DATE | CURRENT_DATE
+        | CURRENT TIME | CURRENT_TIME
+        | CURRENT TIMESTAMP | CURRENT_TIMESTAMP
+        | <varname>literal</varname>
+</b></codeblock>
+<p>For details about Derby <varname>literal</varname> values, see 
+<xref href="crefsqlj31068.dita#crefsqlj31068"></xref>.</p>
+<p>The values in a <varname>DefaultConstantExpression</varname> must be 
+compatible in type with the column, but a 
+<varname>DefaultConstantExpression</varname> has the following additional type 
+restrictions:</p>
+<ul>
+<li>If you specify USER, CURRENT_USER or SESSION_USER, the column must be a
+character column whose length is at least 8.</li>
+<li>If you specify CURRENT SCHEMA or CURRENT SQLID, the column must be a 
+character column whose length is at least 128.</li>
+<li>If the column is an integer type, the default value must be an
+integer literal.</li>
+<li>If the column is a decimal type, the scale and precision of the default 
+value must be within those of the column.</li>
+</ul></section>
 </refbody>
 </reference>

Modified: db/derby/docs/trunk/src/ref/rrefsqlj81859.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj81859.dita?rev=584173&r1=584172&r2=584173&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj81859.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj81859.dita Fri Oct 12 07:57:50 2007
@@ -55,7 +55,9 @@
 <example id="rrefaltercolumndef"> <title>column-definition</title><codeblock><b><i><xref
 href="rrefsimplecolumnname.dita#rrefsimplecolumnname">Simple-column-Name</xref></i> <i>DataType</i>
 [ <i><xref href="rrefsqlj16095.dita#rrefsqlj16095">Column-level-constraint</xref></i> ]*
-[ [ WITH ] DEFAULT {<i>ConstantExpression</i> | NULL } ]</b></codeblock></example>
+[ [ WITH ] DEFAULT <varname>DefaultConstantExpression</varname> ]</b></codeblock>
+<p>For details on <varname>DefaultConstantExpression</varname>, see 
+<xref href="rrefsqlj30540.dita#sqlj64478">Column default</xref>.</p></example>
 <example id="rrefsqlj37860"><title>column-alteration</title><codeblock><b><i>column-Name</i> SET DATA TYPE VARCHAR(integer) |
 <i>column-name</i> SET INCREMENT BY integer-constant |
 <i>column-name</i> RESTART WITH integer-constant |