Skip to content

Issue with "week" in date_add function #9785

@Fransoic

Description

@Fransoic

What happens?

When using the date_add function with the interval keyword "week," DuckDB throws a syntax error. This issue is specific to "week," as it works correctly with other keywords like "month."

To Reproduce

  1. Execute the following SQL query using DuckDB:

    SELECT date_add(INTERVAL 3 month, current_date);
    

    Expected output: A date that is three months from the current date.

    Actual output: The query executes successfully, and the output is correct.

  2. Execute the following SQL query using DuckDB:

    SELECT date_add(INTERVAL 3 week, current_date);
    

    Expected output: A date that is three weeks from the current date.

    Actual output: DuckDB throws a syntax error:

    Parser Error: syntax error at or near "week"
    LINE 1: SELECT date_add(INTERVAL 3 week, current_date);
    
  3. Execute the following SQL query using DuckDB as a workaround:

    SELECT date_add(INTERVAL '3 week', current_date);
    

    Expected output: A date that is three weeks from the current date.

    Actual output: The query executes successfully, and the output is correct.

OS:

https://shell.duckdb.org/

DuckDB Version:

web

DuckDB Client:

@duckdb/duckdb-wasm@1.28.1-dev23.0

Full Name:

Francois CORIC

Affiliation:

None

Have you tried this on the latest main branch?

I have not tested with any build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

Labels

Needs DocumentationUse for issues or PRs that require changes in the documentationreproduced

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions