Skip to content

get_table_names erroring on query using generate_series in CTE, but executes it without issue #12293

@dylanscott

Description

@dylanscott

What happens?

I've encountered a relatively simple query which uses generate_series in a CTE which can be executed just fine, but trying to call get_table_names on it yields the error:

Traceback (most recent call last):
  File "/Users/dscott/Hex/duckdb-repro/repro.py", line 13, in <module>
    print(conn.get_table_names(query))
  File "/Users/dscott/Hex/duckdb-repro/repro.py", line 13, in <module>
    print(conn.get_table_names(query))
duckdb.duckdb.BinderException: Binder Error: RANGE with NULL argument is not supported

On older versions (0.8.1) the error is slightly different, and more fatal as subsequent queries against the same connection error and report "The database must be restarted prior to being used again."

Traceback (most recent call last):
  File "/Users/dscott/Hex/duckdb-repro/repro.py", line 13, in <module>
    print(conn.get_table_names(query))
  File "/Users/dscott/Hex/duckdb-repro/repro.py", line 13, in <module>
    print(conn.get_table_names(query))
duckdb.InternalException: INTERNAL Error: Calling GetValueInternal on a value that is NULL

To Reproduce

Here's a minimal reproduction:

import duckdb

query = """
with series_generator as (
   select * from generate_series(TIMESTAMP '2001-04-10', TIMESTAMP '2001-04-11', INTERVAL 1 HOUR)
)
select * from series_generator
"""

with duckdb.execute(query) as conn:
    print(conn.fetchdf())

    print(conn.get_table_names(query))

OS:

macOS Sonoma aarch64, Linux x86_64

DuckDB Version:

0.8.1, 0.10.3, 0.10.4.dev72

DuckDB Client:

Python

Full Name:

Dylan Scott

Affiliation:

Hex Technologies

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions