aliasing3

This commit is contained in:
Priec
2026-08-13 14:41:27 +02:00
parent 5fe630fff7
commit 1f8b73793d
8 changed files with 110 additions and 62 deletions

View File

@@ -13,7 +13,10 @@
use crate::schema::{ColumnCatalog, ColumnDraft, columns_from_rows};
use super::draft::{ACCOUNT_API_COLUMN, ACCOUNTING_FIELD_TYPE, GeneratedAlias, TableDraft};
use super::draft::{
ACCOUNT_API_COLUMN, ACCOUNTING_FIELD_TYPE, ACCOUNTING_TRANSFER_FIELD_TYPE, GeneratedAlias,
TableDraft,
};
/// The `profile_name` option meaning "create a new profile too".
pub(crate) const NEW_PROFILE: &str = "__new__";
@@ -223,12 +226,10 @@ impl AddTablePageState {
alias: String::new(),
});
// A generated column is named by the backend, but the name is a
// display name, and ACCOUNTING's columns can be given one of the
// user's own in the request that creates them. Only ACCOUNTING's:
// see `TableDraft::aliasable_generated_columns` for why the other
// generated columns cannot be renamed at all.
let aliasable = column.data_type == ACCOUNTING_FIELD_TYPE;
// Every generated column with persisted provenance may be named by
// the request. Transfer connectors are still resolved by fixed
// backend names and remain the exception.
let aliasable = column.data_type != ACCOUNTING_TRANSFER_FIELD_TYPE;
for generated in columns.generated_columns_of(index) {
let mut tags = vec![format!("generated by {}", column.data_type)];