apache / apache/shardingsphere

PostgreSQL You have an error in your SQL syntax: SELECT interval '1 -2:03' minute to second

Open
#23,595 0 comments 0 reactions 0 assignees View on GitHub
db: PostgreSQL in: SQL parse
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 38m
Merged PRs (30d)
326

Description

## Bug Report

### Which version of ShardingSphere did you use?

master - 6b095c835f5334f01bb6643565ddb3276e9f9a56

### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

### Expected behavior

```
postgres=# SELECT interval '1 -2:03' minute to second;
interval
-----------------
1 day -00:02:03
(1 row)
```
![image](https://user-images.githubusercontent.com/20503072/212792535-e176af59-ae9e-450a-b421-a4e4adfdbee2.png)

### Actual behavior

```
postgres=> SELECT interval '1 -2:03' minute to second;
ERROR: You have an error in your SQL syntax: SELECT interval '1 -2:03' minute to second;, null
```
![image](https://user-images.githubusercontent.com/20503072/212792581-744c4868-ebf5-43c2-9291-30ea4aefac5c.png)

PostgreSQL grammar: https://github.com/postgres/postgres/blob/58597edea102258b21d5f4b4f0d7796c0ebf100a/src/backend/parser/gram.y#L16452-L16458

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `SELECT interval '1 -2:03' minute to second;` and compare it with the PostgreSQL grammar linked in the issue. Trace how ShardingSphere parses this interval expression; done means the query is accepted and returns the expected `1 day -00:02:03` result.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.