db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3010) WITH DEFAULT value documentation may seem too liberal
Date Sun, 07 Oct 2007 15:40:50 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532974
] 

Dag H. Wanvik commented on DERBY-3010:
--------------------------------------

Also missing from the documentation of default column values are
restrictions on the column type/default values, restriction which are partly
non-standard:

If the default value is USER or CURRENT_SCHEMA: in addition to being a
CHAR type, the type must also have a (maximum) size of at least 8, and
128, respectively. 

The standard requires at least 128 in both cases, cf. SQL 2003, section 11.5,
syntax rule 4b. 

In the USER case, when applying the default, it may happen that the
column is too narrow, since Derby has no restriction on user names to be
max 8 characters. Derby does throw a truncation error (22001) if the
column is too narrow in this case, though.

In the CURRENT_SCHEMA case, it is not an issue, since the schema
identifier can be max 128 long.

I can't find these limits documented in the reference manual (CREATE
TABLE; rrefsqlj30540.html, ALTER TABLE: rrefsqlj81859.html). 
Is it documented elsewhere? 




> WITH DEFAULT value documentation may seem too liberal
> -----------------------------------------------------
>
>                 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
>            Priority: Minor
>
> 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.


Mime
View raw message