{"record":{"id":"a24923639f49f0fa","repo":"PRQL/prql","slug":"name-input-to-append-by-name-must-have-all-colum","errorCode":null,"errorMessage":"{name} input to append by:name must have all columns defined","messagePattern":"(.+?) input to append by:name must have all columns defined","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/semantic/resolver/transforms.rs","lineNumber":277,"sourceCode":"                        }\n                    }\n                };\n\n                // TODO: support database engine-level UNION ALL BY NAME in PR #6037\n                if by_name {\n                    // input validation for PRQL-native implementation\n                    for (name, rel) in [(\"top\", top.clone()), (\"bottom\", bottom.clone())] {\n                        let lineage = rel.lineage.clone().ok_or_else(|| {\n                            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 {","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/semantic/resolver/transforms.rs#L259-L295","documentation":"PRQL's native `append ... by:name` needs every column of both inputs to be individually known. If an input's lineage contains a wildcard `All` column (columns not yet expanded, e.g. from `from tbl` without a `select`), the compiler cannot perform by-name matching and throws this error. A hint suggests adding a `select` earlier in the pipeline.","triggerScenarios":"Running `from employees | append managers by:name` where either side still has a star/wildcard column set (no `select`), so the lineage contains a `LineageColumn::All` entry.","commonSituations":"Using `by:name` directly on raw `from table` inputs; forgetting to narrow columns before the append; assuming PRQL auto-expands `table.*` for by-name unions.","solutions":["Add a `select [col1, col2, ...]` before `append ... by:name` on the input that has undefined columns.","List all columns explicitly on both sides so names are known to the compiler.","Use positional `append` (no `by:`) if exact column lists are impractical.","Replace `select *`-style usage with an explicit column list."],"exampleFix":"// before\nfrom employees | append managers by:name\n// after\nfrom employees | select [id, name] | append (from managers | select [id, name]) by:name","handlingStrategy":"validation","validationCode":"// Require an explicit select before every by:name append\nfunction requireSelectBeforeByName(prql) {\n  const idx = prql.search(/append\\s+\\S+\\s+by:name/);\n  if (idx >= 0 && !/select\\s+\\[[^\\]]+\\]\\s*\\|\\s*append/.test(prql)) {\n    throw new Error('add an explicit select [cols...] before append by:name');\n  }\n}","typeGuard":"function hasExplicitSelect(pipeline) {\n  return /\\|\\s*select\\s+\\[[^\\]]+\\]/.test(pipeline);\n}","tryCatchPattern":"try {\n  const sql = prqlc.compile(query);\n} catch (e) {\n  if (e.message.includes('must have all columns defined')) {\n    // auto-insert a select of known columns before the offending input\n  } else throw e;\n}","preventionTips":["Always list columns explicitly with `select` before `append by:name`.","Avoid wildcard column sets when by-name matching is needed.","Prefer positional `append` when column lists are unstable."],"tags":["prql","append-transform","columns","lineage"],"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"}