{"record":{"id":"3a479a4197863543","repo":"PRQL/prql","slug":"name-input-to-append-by-name-must-not-have-any-u","errorCode":null,"errorMessage":"{name} input to append by:name must not have any unnamed columns","messagePattern":"(.+?) input to append by:name must not have any unnamed columns","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/semantic/resolver/transforms.rs","lineNumber":286,"sourceCode":"                            Error::new(Reason::Expected {\n                                who: Some(format!(\"`{name}`\")),\n                                expected: \"relation\".to_string(),\n                                found: write_pl(rel.clone()),\n                            })\n                            .with_span(rel.span)\n                        })?;\n\n                        lineage.columns.iter().try_for_each(|c| match c {\n                            LineageColumn::All { .. } => Err(Error::new(Reason::Simple(format!(\n                                \"{name} input to append by:name must have all columns defined\"\n                            )))\n                            .push_hint(\"try adding a select earlier in the pipeline\")\n                            .with_span(rel.span)),\n                            LineageColumn::Single {\n                                name: None,\n                                target_name: None,\n                                ..\n                            } => Err(Error::new(Reason::Simple(format!(\n                                \"{name} input to append by:name must not have any unnamed columns\"\n                            )))\n                            .with_span(rel.span)),\n                            _ => Ok(()),\n                        })?;\n                    }\n\n                    return Ok(new_binop(bottom, &[\"std\", \"_append_by_name\"], top));\n                } else {\n                    (TransformKind::Append(Box::new(bottom)), top)\n                }\n            }\n            \"loop\" => {\n                let [pipeline, tbl] = unpack::<2>(func.args);\n\n                let pipeline = self.fold_by_simulating_eval(pipeline, &tbl)?;\n\n                (TransformKind::Loop(Box::new(pipeline)), tbl)","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/semantic/resolver/transforms.rs#L268-L304","documentation":"For `append ... by:name`, every column in each input must have a name, since columns are matched by name. This error is raised when an input contains an unnamed column (e.g. an anonymous expression column produced without an alias), making by-name matching impossible.","triggerScenarios":"Appending with `by:name` where an input pipeline contains an expression column without an alias, such as `select [count]` on an aggregate without naming, or `derive`/`select` of an expression that yields `LineageColumn::Single { name: None }`.","commonSituations":"Selecting raw expressions (e.g. `select [amount * 1.1]`) without an alias before a by-name append; unnamed aggregate outputs; columns from functions that don't assign names.","solutions":["Alias every expression column before the append, e.g. `select [total = amount * 1.1]`.","Ensure aggregates are named: `aggregate [total = sum amount]`.","Inspect each input with a `select` listing all named columns.","Fall back to positional `append` if names are irrelevant."],"exampleFix":"// before\nfrom t | select [amount * 1.1] | append other by:name\n// after\nfrom t | select [adjusted = amount * 1.1] | append other by:name","handlingStrategy":"validation","validationCode":"// Ensure every select item in by:name pipelines has an alias\nfunction allSelectItemsNamed(prql) {\n  const selects = prql.match(/select\\s+\\[([^\\]]+)\\]/g) || [];\n  for (const s of selects) {\n    for (const item of s.slice(s.indexOf('[') + 1, -1).split(',')) {\n      const t = item.trim();\n      if (t && !/^\\w+$/.test(t) && !/\\w\\s*=/.test(t)) {\n        throw new Error(`unnamed column in select: ${t}; alias it as name = ${t}`);\n      }\n    }\n  }\n}","typeGuard":"function isNamedSelectItem(item) {\n  return /^\\w+$/.test(item.trim()) || /^[\\w.]+\\s*=/.test(item.trim());\n}","tryCatchPattern":"try {\n  const sql = prqlc.compile(query);\n} catch (e) {\n  if (e.message.includes('must not have any unnamed columns')) {\n    // flag the expression column and add an alias\n  } else throw e;\n}","preventionTips":["Alias every computed column: `select [total = amount * 1.1]`.","Name all aggregates: `aggregate [total = sum amount]`.","Lint pipelines: no bare expressions in select before by:name appends."],"tags":["prql","append-transform","columns","naming"],"backgroundTag":"schema-validation-failed","analyzedSha":"e164e249b99485890036eb60f57c37520379b240","analyzedAt":"2026-09-09T12:18:38.727Z","contentChangedAt":"2026-09-09T12:18:38.727Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}