#3509·prql

Suprising errors on small examples

Author: snthCreated Sep 13, 2023Updated Jul 6, 2026
Labelscompilererror-messages

What's up?

Empty table literal

bash
echo "from [{}]" | prqlc compile
Error: invalid RQ: table ref without columns

wat?

bash
echo "[{}]" | prqlc compile
Error: invalid RQ: table ref without columns

wat?

bash
echo "[]" | prqlc compile
The application panicked (crashed).
Message:  called `Option::unwrap()` on a `None` value
Location: /home/tobias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prql-compiler-0.9.4/src/semantic/lowering.rs:325

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

wat wat?

NULL rows or columns

bash
echo "from tbl|filter false==true" | prqlc compile
SELECT
  *
FROM
  tbl
WHERE
  false = true

-- Generated by PRQL compiler version:0.9.4 (https://prql-lang.org)

ok

bash
echo "from tbl|select {}|filter false==true" | prqlc compile
Error:
   ╭─[:1:27]
   │
 1 │ from tbl|select {}|filter false==true
   │                           ──┬──
   │                             ╰──── Unknown name
───╯

wat?

bash
echo "from playlists.csv|take 3|filter false==true" | prqlc compile | duckdb
┌─────────────┬─────────┐
│ playlist_id │  name   │
│    int64    │ varchar │
├───────────────────────┤
│        0 rows         │
└───────────────────────┘

ok

bash
echo "from playlists.csv|take 3|filter false==true|select {}" | prqlc compile | duckdb
┌────────┐
│  NULL  │
│ int32  │
├────────┤
│ 0 rows │
└────────┘
ok

❯ echo "from playlists.csv|take 3|select {}|filter false==true" | prqlc compile | duckdb
Error:
   ╭─[:1:44]
   │
 1 │ from playlists.csv|take 3|select {}|filter false==true
   │                                            ──┬──
   │                                              ╰──── Unknown name
───╯

wat?

Background

I'm trying to create an empty result set for nefarious purposes in the least amount of code necessary and found these along the way.