Skip to content

Commit

Permalink
fix: add error msg for no rows in from_text (#4421)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-span committed Apr 26, 2024
1 parent 8c4c0a0 commit 1e3303c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions prqlc/prqlc/src/sql/gen_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,15 @@ fn translate_relation_literal(data: RelationLiteral, ctx: &Context) -> Result<sq
selects.push(body)
}

if selects.is_empty() {
return Err(
Error::new_simple("No rows provided for `from_text`".to_string()).push_hint(
"add a newline, then a row of data following the column. If using \
the json format, ensure `data` isnt empty",
),
);
}

let mut body = selects.remove(0);
for select in selects {
body = SetExpr::SetOperation {
Expand Down

0 comments on commit 1e3303c

Please sign in to comment.