Skip to content

Handle Doltgres types in least/greatest functions #2378

@angelamayxie

Description

@angelamayxie

These queries are valid in Postgres

postgres=# create table t(a decimal(6, 2), b decimal(8, 5), c decimal(5, 1));
CREATE TABLE
postgres=# insert into t values (2.75, 8.8, 3.1);
INSERT 0 1
postgres=# select greatest(a, b, c), least(a, b, c) from t;
 greatest | least 
----------+-------
  8.80000 |  2.75
(1 row)

However, the same queries (added as a test in dolthub/go-mysql-server#3447) fails in Doltgres with the following error message

Unexpected error for query select greatest(a, b, c), least(a, b, c) from t;: ERROR: unsupported type for greatest/least argument: *types.DoltgresType 

This is because we don't handle Doltgres types in the greatest/least implementation in dolthub/go-mysql-server.

Note that the decimal precision in Postgres is different from the precision in MySQL (dolthub/dolt#10567)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions