You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2008/10/29 14:41:44 UTC

[jira] Updated: (DERBY-3922) Enable the adding of generated columns via ALTER TABLE

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

Rick Hillegas updated DERBY-3922:
---------------------------------

    Attachment: derby-3922-01-aa-repopulate.diff

Attaching derby-3922-01-aa-repopulate.diff. This patch causes a generated column to be populated when it is added to an existing table via an ALTER TABLE ADD COLUMN statement. Running regression tests now.

This patch makes the following changes:

1) Fixes the nested UPDATE statement which is built by the execution machinery for ALTER TABLE. That nested UPDATE needed to be sensitive to whether it was updating a generated column. When updating a generated column, the value needs to be set to the DEFAULT literal since that is the only legal value which can be explicitly poked into a generated column.

2) Fixes a couple bugs in the bind-time logic for UPDATEs which explicitly set generated columns to the DEFAULT literal:

  a) The touched columns were not being recorded on the list of
  affected generated columns.

  b) The logic to determine which columns were being touched did not
  return the correct results. That logic had been cribbed from
  elsewhere in the bind() code but the context needed to make it work
  had not been set up yet. I replaced that logic with a different way
  to determine which columns were being touched.


Touches the following files:

M      java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java

Changes the bind() logic to fix the bugs described in (2) above.


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

Changes the execution logic to accomplish (1).


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

Adds tests for ALTER TABLE and adds tests to verify that the bugs in (2) are fixed.


> Enable the adding of generated columns via ALTER TABLE
> ------------------------------------------------------
>
>                 Key: DERBY-3922
>                 URL: https://issues.apache.org/jira/browse/DERBY-3922
>             Project: Derby
>          Issue Type: Task
>          Components: SQL
>    Affects Versions: 10.5.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-3922-01-aa-repopulate.diff
>
>
> The initial grammar patch for generated columns did not include ALTER TABLE support. This support cannot be added until we check in the UPDATE logic for generated columns. Adding a generated column to an existing table is supposed to calculate the generated column's values for all rows currently in the table.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.