Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL does not return expected timezone #790

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

keif888
Copy link

@keif888 keif888 commented Mar 1, 2025

Explain your user case and expected results

Configure the database server as timezone UTC (mysql, sqlite and postgres).
Configure the connection string as timezone UTC.
Create a record in the database using a GO time with UTC as the time.Location.
Retrieve the record from the database.

Expected Results

The time.Location on the retrieved record should be UTC.

Actual Results

DBMS Results
mysql time.Location = UTC
sqlite time.Location = UTC
postgres time.Location = Local
mssql not tested as TLS handshake failed

Potential Workaround

I have added an extra test TestPGXPooltoSqlDB which shows how to use Gorm's capability of using an sql.DB to connect, and work around the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant