← rename operator page · clause/rename/basic/new_name_already_in_operand

New name already in operand 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

rename Me_1 to Me_2, on a data set that already has the measure Me_2: the first error condition that the page states.

Manual:

Change of Component name: "the component used in the dsc_to cannot have the same names as other Components of the result Data Set".

Expected:

The error 1-1-6-8, "Cannot use component {comp_name} for rename, it is already in the Dataset {dataset_name}.", for "The resulting Data Set, after renaming the specified Components, must have unique names of all its Components (otherwise a runtime error is raised)": the result would have two components named Me_2. The page calls it a runtime error, but a name clash is a condition on the structures alone, so vtlengine raises it as a SemanticError and no 2-* message states it.

script.vtl ⇩

DS_r := DS_1 [ rename Me_1 to Me_2 ];

input/DS_1.csv ⇩

Id_1Me_1Me_2
110100
220200

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/error.json ⇩

{"code": "1-1-6-8"}