hasura / hasura/graphql-engine
MySQL/MariaDB insert fails for datetime_with_timezone columns – generates invalid timestamp with time zone literal
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version:
2.38.1
### Environment
EE
### What is the current behaviour?
When inserting into a MariaDB table with TIMESTAMP columns tracked in Hasura, Hasura exposes those columns as the GraphQL scalar datetime_with_timezone.
When executing an insert_* mutation against those columns, the MySQL/MariaDB connector generates SQL that includes a PostgreSQL-style literal cast:
timestamp with time zone '2025-08-14 14:59:45+00:00'
This syntax is not valid in MySQL/MariaDB, resulting in a syntax error.
Error returned:
```
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'with time zone '2025-08-14 14:59:45+00:00'..."
```
Impact: Any MySQL/MariaDB table with TIMESTAMP columns mapped as datetime_with_timezone cannot be inserted into via the generated mutations.
### What is the expected behaviour?
Inserts work as expected
### How to reproduce the issue?
1. Create table in mariadb with timestamp column
2.Track table
3. Graphql schema for timestamp column is typed as datetime_with_timezone
4. Run mutation for example:
```
mutation insert {
insert_test_table(objects: {start_time: "2025-01-02T12:01:02+00:00", id: 10, end_time: "2025-01-02T12:01:02+00:00", user_id: "23232"}) {
affected_rows
}
}
}
```
### Screenshots or Screencast
### Please provide any traces or logs that could help here.
### Any possible solutions/workarounds you're aware of?
Use DATETIME column type instead, and graphql schema generates a datetime type
### Keywords
Contributor guide
Research direction
Start with the MySQL/MariaDB connector path that builds SQL for insert mutations and handles the datetime_with_timezone scalar. Reproduce the issue using the MariaDB TIMESTAMP table and mutation described here, then verify that the generated insert uses syntax accepted by MySQL/MariaDB and completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, mariadb, mysql
- Domain
- api, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100