Skip to content

Add pmin pmax function support for sql server #1602

Description

@eric-fey-hus

SQL Server (Transact SQL) support for pmin and pmax functions can easily be added.

Lines 295f in tidyverse dbplyr/R/backend-mssql.R state pmin, pmax not supported. But SQL Server (Transact SQL supports this:
SQL Server (Transact SQL) supports LEAST and GREATEST as already implemented in backend-.R,
see https://learn.microsoft.com/en-us/sql/t-sql/functions/logical-functions-least-transact-sql?view=sql-server-ver16

Therefore I propose to remove

      pmin          = sql_not_supported("pmin"),
      pmax          = sql_not_supported("pmax"),

which allows dbplyr/R/backend-.R lines 217f covers to work as expected

      pmin = sql_aggregate_n("LEAST", "pmin"),
      pmax = sql_aggregate_n("GREATEST", "pmax"),

and that is supported in SQL Server and Transact SQL.

Tested this locally on my fork using DBI and odbc: "ODBC Driver 18 for SQL Server", and it worked.

Can I create a pull request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions