Skip to content

User-defined function called "time_bucket" triggers internal errorย #10189

Closed

Description

@akuzm
-- Query against a hypertable that calls a user-defined function named
-- time_bucket raises SQLSTATE XX000 at planning time.
            
CREATE TABLE beverage_pours (served_at bigint NOT NULL, drink_name text);
SELECT create_hypertable('beverage_pours', 'served_at', chunk_time_interval => 1000);
INSERT INTO beverage_pours VALUES (1, 'mojito'), (100, 'negroni'), (500, 'spritz');
                             
CREATE FUNCTION time_bucket(int, text) RETURNS text
    AS $$ BEGIN RETURN left($2, $1); END $$ LANGUAGE plpgsql;
                                          
-- baseline: an equivalent qual not calling time_bucket returns three rows
SELECT * FROM beverage_pours WHERE left(drink_name, 1) < 'z';
                    
-- same qual through the user-defined time_bucket function
SELECT * FROM beverage_pours WHERE time_bucket(1, drink_name) < 'z';
-- ERROR:  XX000: unsupported datatype in const_to_integral_timeval: text

Activity

  1. added
    llm-fuzzer
    on Jul 1, 2026
  2. added
    internal error
    on Jul 30, 2026
  3. added 6 commits that reference this issue on Aug 10, 2026
    e666ec2
    f10cc2e
    8ada32d
    3915dde
    76edf12
    d7cd2e6
  4. added a commit that references this issue on Aug 12, 2026
    c3b5e79
  5. added a commit that references this issue on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buginternal errorllm-fuzzer

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions