Skip to content

Ambiguous and non-idempotent interval formatting / parsing for HH:MM:SS format with negative intervals #8512

@bcolloran

Description

@bcolloran

What happens?

When dealing with negative intervals, the HH:MM:SS formatting of intervals cannot be pasted into another interval expression without losing the negative sign. I would expect that any string representation returned by the duckDB shell should be a valid input in a subsequent expression, and that it would return the same value as the first expression -- i.e., looking for lossless/idempotent round trips between inputs and output strings.

Note that I'm not looking for the output formatting to retain the same formatting as the input, but an output string should parse to a semantically equivalent value.

D select interval '-5h' as test_interval ;
┌───────────────┐
│ test_interval │
│   interval    │
├───────────────┤
│ -05:00:00     │
└───────────────┘
D select interval '-05:00:00' as test_interval ;
┌───────────────┐
│ test_interval │
│   interval    │
├───────────────┤
│ 05:00:00      │
└───────────────┘

To Reproduce

in the duckdb shell, enter:

 select interval '-5h' as test_interval ;

select interval '-05:00:00' as test_interval ;

OS:

ubuntu 22.04

DuckDB Version:

v0.8.1 6536a77

DuckDB Client:

cli

Full Name:

brendan c

Affiliation:

Rill Data

Have you tried this on the latest master branch?

I have tested with a release build (and could not test with a master 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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions