[
https://issues.apache.org/jira/browse/DERBY-3010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dag H. Wanvik updated DERBY-3010:
---------------------------------
Attachment: defaultConstantExpression.txt
Here is a draft for refman: I derived this from looking at the code of
ColumnDefinitionNode.java. Comments, anyone? Other things that should be
mentioned?
* column definition:
Simple-column-NameDataType
[ Column-level-constraint ]*
[ [ WITH ] DEFAULT { DefaultConstantExpression | NULL }
|generated-column-spec ]
[ Column-level-constraint ]*
* Column default:
For the definition of a default value, a DefaultConstantExpression is
an expression that does not refer to any table. It can include
constants, date-time special registers, current schemas, users, and
null:
DefaultConstantExpression:
NULL
| CURRENT { SCHEMA | SQLID }
| USER | CURRENT_USER | SESSION_USER
| DATE
| TIME
| TIMESTAMP
| CURRENT DATE | CURRENT_DATE
| CURRENT TIME | CURRENT_TIME
| CURRENT TIMESTAMP | CURRENT_TIMESTAMP
| Literal
To understand Derby literals, see section SQL language reference->Data
types.
Values must be type compatible with the column, but is slightly more
restrictive than elsewhere in Derby, see below.
If USER, CURRENT_USER or SESSION_USER is used, the column must be a
character column, whose length is at least 8. If SCHEMA or SQLID is
used, the column must be a character column whose length is at least
128.
If the column is an integer type, the default value has to be an
integer literal.
If the column is a decimal type, the scale and precision of the value
should be within those of the column.
> WITH DEFAULT value documentation needs improvement
> --------------------------------------------------
>
> Key: DERBY-3010
> URL: https://issues.apache.org/jira/browse/DERBY-3010
> Project: Derby
> Issue Type: Improvement
> Components: Documentation
> Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1,
> 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.4.0.0
> Reporter: Dag H. Wanvik
> Assignee: Kim Haase
> Priority: Minor
> Attachments: defaultConstantExpression.txt
>
>
> The descrition in the reference manual for DEFAULT value option, leads
> one to assume that the value may be specified as a constant
> expression, e.g. as (0), whereas Derby (in compliance with the SQL
> standard) is more restrictive.
> In the specifications for CREATE and ALTER TABLE (rrefsqlj81859.dita
> and rrefsqlj30540.dita), "ConstantExpression" is used:
> column-definition:
> :
> [ [ WITH ] DEFAULT { ConstantExpression | NULL }
> | generated-column-spec ]
> :
> This non-terminal symbol is explained in rrefsqlj30540.dita:
> "For the definition of a default value, a ConstantExpression is an
> expression that does not refer to any table. It can include constants,
> date-time special registers, current schemas, users, and null."
> Perhaps one could change the name to ConstantValue and explain it
> as:
> "For the definition of a default value, a ConstantValue means literals,
> date-time special registers, current schemas, users, and null."
> Or better, one could be more explicit and spell out the options in
> more detail..
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.