Skip to content

the first value in VALUES should not determine the column type #1648

Closed

Description

@jennifersp

Repro:

In Doltgres:

postgres=> SELECT SUM(n::numeric) FROM (VALUES(1),(2.01),(3)) v(n);
ERROR:  integer: unhandled type: decimal.Decimal (errno 1105) (sqlstate HY000)
postgres=> SELECT SUM(n::numeric) FROM (VALUES(1.01),(2),(3)) v(n);
ERROR:  interface conversion: interface {} is int32, not decimal.Decimal

In Postgres:

postgres=> postgres=# SELECT SUM(n::numeric) FROM (VALUES(1),(2.01),(3)) v(n);
 sum  
------
 6.01
(1 row)

postgres=# SELECT SUM(n::numeric) FROM (VALUES(1.01),(2),(3)) v(n);
 sum  
------
 6.01
(1 row)

Activity

  1. added
    bug
    on Jul 15, 2025
  2. codeaucafe commented on Dec 23, 2025

    @codeaucafe
    Contributor

    I'm going to take a stab at this and work on it if thats fine with y'all.

  3. codeaucafe commented on Jan 9, 2026

    @codeaucafe
    Contributor

    FYI, I've been working on this. Will push up a (maybe draft at first) PR here before end of weekend.

  4. added a commit that references this issue on Feb 24, 2026
  5. added a commit that references this issue on Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions