Repository: tobymao/sqlglot

Issue:
Postgres silently drops negative sign from interval expression
**Fully reproducible code snippet**
```python
import sqlglot

print(sqlglot.__version__)
# 26.15.0

x = sqlglot.parse_one("interval '-1 month'", dialect="postgres")
print(x.sql(dialect="postgres"))
# INTERVAL '1 MONTH'
```

This should return `INTERVAL '-1 MONTH'`. Silently dropping the negative sign causes this to fail identity checks.

**Official Documentation**
https://www.postgresql.org/docs/current/datatype-datetime.html

Hints from issue comments:

Solution patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index e4f0706726..db089e5fd5 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -7865,7 +7865,7 @@ def parse_identifier(name: str | Identifier, dialect: DialectType = None) -> Ide
     return expression
 
 
-INTERVAL_STRING_RE = re.compile(r"\s*([0-9]+)\s*([a-zA-Z]+)\s*")
+INTERVAL_STRING_RE = re.compile(r"\s*(-?[0-9]+)\s*([a-zA-Z]+)\s*")
 
 
 def to_interval(interval: str | Literal) -> Interval:


Test patch:
diff --git a/tests/dialects/test_postgres.py b/tests/dialects/test_postgres.py
index cd58dee56f..957eb9d5b9 100644
--- a/tests/dialects/test_postgres.py
+++ b/tests/dialects/test_postgres.py
@@ -76,6 +76,7 @@ def test_postgres(self):
         self.validate_identity("SELECT CURRENT_SCHEMA")
         self.validate_identity("SELECT CURRENT_USER")
         self.validate_identity("SELECT * FROM ONLY t1")
+        self.validate_identity("SELECT INTERVAL '-1 MONTH'")
         self.validate_identity(
             "SELECT * FROM test_data, LATERAL JSONB_ARRAY_ELEMENTS(data) WITH ORDINALITY AS elem(value, ordinality)"
         )