db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-481) implement SQL generated columns
Date Fri, 07 Nov 2008 19:11:46 GMT

     [ https://issues.apache.org/jira/browse/DERBY-481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Hillegas updated DERBY-481:
--------------------------------

    Attachment: derby-481-14-ab-dropColumn.diff

Attaching derby-481-14-ab-dropColumn.diff. Running tests now. This patch implements CASCADEd
and RESTRICTed drops of columns which are referenced by generated columns, per the spec. In
short, if a generated column depends on the column being dropped, then RESTRICT aborts the
drop and CASCADE causes the generated column to be dropped along with the original column.
Makes the following changes:

A) Reworks the implementation of the default descriptor so that it contains an array of referenced
column names rather than column positions. This eliminates the need to remap those column
positions when other columns are dropped.

B) Makes the drop column logic recursively call itself for generated columns which depend
on the original column being dropped.


Touches the following files:

M      java/engine/org/apache/derby/catalog/DefaultInfo.java
M      java/engine/org/apache/derby/catalog/types/DefaultInfoImpl.java

Changes to the default descriptor needed for (A).


M      java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
M      java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
M      java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java

Accomodations for (A) in code which uses default descriptors.


M      java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java

Reworks dropColumnFromTable() so that it calls itself on affected generated columns.


M      java/engine/org/apache/derby/loc/messages.xml
M      java/shared/org/apache/derby/shared/common/reference/SQLState.java

New error message and warning.


M      java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java

New tests for ALTER TABLE DROP COLUMN scenarios involving generated columns.


> implement SQL generated columns
> -------------------------------
>
>                 Key: DERBY-481
>                 URL: https://issues.apache.org/jira/browse/DERBY-481
>             Project: Derby
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions: 10.0.2.1
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-481-00-aa-prototype.diff, derby-481-01-aa-catalog.diff, derby-481-02-aa-utilities.diff,
derby-481-03-aa-grammar.diff, derby-481-04-aa-insert.diff, derby-481-05-aa-update.diff, derby-481-06-aa-genreferences.diff,
derby-481-07-aa-noSQLinRoutines.diff, derby-481-07-ab-noSQLinRoutines.diff, derby-481-08-aa-castToDeclaredType.diff,
derby-481-09-aa-dummyDefaults.diff, derby-481-10-aa-foreignKeyActions.diff, derby-481-11-aa-notNull.diff,
derby-481-12-aa-padding.diff, derby-481-13-aa-alterDatatype.diff, derby-481-14-ab-dropColumn.diff,
GeneratedColumns.html
>
>
> Satheesh has pointed out that generated columns, a SQL 2003 feature, would satisfy the
performance requirements of Expression Indexes (bug 455). Generated columns may not be as
elegant as Expression Indexes, but they are easier to implement. We would allow the following
new kind of column definition in CREATE TABLE and ALTER TABLE statements:
>     columnName GENERATED ALWAYS AS ( expression )
> If expression were an indexableExpression (as defined in bug 455), then we could create
indexes on it. There is no work for the optimizer to do here. The Language merely has to compute
the generated column at INSERT/UPDATE time.

-- 
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