plusplusjiajia opened a new pull request, #165:
URL: https://github.com/apache/terraform-provider-iceberg/pull/165

   ## What
   
   Renames an `iceberg_table` in place when its `name` changes, instead of 
dropping it and creating an empty table under the new name. The table keeps its 
data, snapshots and history.
   
   ## Notes
   
   - `name` no longer uses `RequiresReplace`. `Update` calls `RenameTable` 
first and then commits any other changes in the same plan, such as a column 
rename, against the new identifier.
   - After a successful rename the new `name` and `id` are written to state 
right away, so the state still points at the table if the following commit 
fails.
   - `id` now plans the new identifier on a rename (`db.old` → `db.new`). 
Otherwise it keeps the value from state, as `UseStateForUnknown` did.
   - `namespace` still replaces the table. Moving a table across namespaces is 
left out because not every catalog supports it.
   - If the catalog rejects the rename, for example because the target name is 
taken, the apply fails and neither table changes.
   
   ## Testing
   
   - `TestAccIcebergTableRename` now keeps the namespace fixed. It checks that 
renaming the table and a column plans an in-place update, that the table UUID 
is unchanged afterwards, and that the old name no longer exists.
   - `TestAccIcebergTableNamespaceChangeReplaces` checks that a namespace 
change still plans a replacement.
   - `TestAccIcebergTableRenameToExistingTable` checks that renaming onto an 
existing table fails and leaves both tables and the state unchanged.
   - `go test ./...` and `staticcheck ./...` pass. With `TF_ACC=1`, all 66 
tests pass against the Iceberg REST fixture. I ran the fixture jar directly 
from Iceberg main with a SQLite JDBC catalog and in-memory FileIO, rather than 
the 1.10.1 Docker image.
   - Against the previous `resource_table.go`, `TestAccIcebergTableRename` 
fails (`expected Update, got action(s): [delete create]`). 
`TestAccIcebergTableRenameToExistingTable` also fails: the original table is 
dropped and the apply then fails with `failed to create table`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to