fixing tests3 - account is reserved when accounting is selected for that table
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
//! leaves the server. A user column is stored under its ordinal and shown only
|
||||
//! under its alias, so an unmapped name at the public boundary is a leak; these
|
||||
//! have no alias to hide behind, because the server -- not the user -- chose
|
||||
//! their names. Anything asking "is this name public?" or "may a user claim
|
||||
//! this name?" is asking about this list, so the list lives here once and the
|
||||
//! `CREATE TABLE` fragments that make it true live next to it.
|
||||
//! their names. The list lives here once and the `CREATE TABLE` fragments that
|
||||
//! make it true live next to it. Alias validation may still be conditional: the
|
||||
//! virtual `account` API name conflicts only on ACCOUNTING-enabled tables.
|
||||
|
||||
/// A column every managed table carries, named the same in Postgres and in the
|
||||
/// public API.
|
||||
@@ -85,8 +85,9 @@ pub fn system_column_names() -> impl Iterator<Item = &'static str> {
|
||||
.chain(std::iter::once(ACCOUNT_REFERENCE_COLUMN))
|
||||
}
|
||||
|
||||
/// Whether `name` is a system column: a name that is safe to show a client
|
||||
/// as-is, and that a user may not claim for a column alias or a table.
|
||||
/// Whether `name` belongs to the system column vocabulary and is safe to show
|
||||
/// to a client as-is. Whether a user may claim a virtual API name as an alias
|
||||
/// is decided with the table's capabilities in scope.
|
||||
pub fn is_system_column(name: &str) -> bool {
|
||||
name == ACCOUNT_API_COLUMN || system_column_names().any(|system_name| system_name == name)
|
||||
}
|
||||
@@ -115,7 +116,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_conditional_column_is_reserved_on_every_table() {
|
||||
fn conditional_system_names_are_recognized() {
|
||||
assert!(is_system_column(ACCOUNT_REFERENCE_COLUMN));
|
||||
assert!(is_system_column(ACCOUNT_API_COLUMN));
|
||||
}
|
||||
|
||||
2
server
2
server
Submodule server updated: 5fa954d3f4...4fe6da6ac7
Reference in New Issue
Block a user