DEFAULT NOW() WITH TIME ZONE 'UTC' is getting ignored, thus returning a naive datetime when queried.

Open
#1,002 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Reproduce the report with asyncpg 0.27.0, PostgreSQL 15.1, and Python 3.10 or 3.11 using a DEFAULT NOW() WITH TIME ZONE 'UTC' column. Start by tracing how that returned value is converted to datetime, then verify that the queried result retains tzinfo while aware datetime insertion continues to work.

Written by the indexing model from the issue text.

Description

  • asyncpg version: 0.27.0
  • PostgreSQL version: 15.1
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : No
  • Python version: 3.11.1 and 3.10.1
  • Platform: Windows 11 or PC
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: Yes
  • If you built asyncpg locally, which version of Cython did you use?: No
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : Probably, never tried.

DEFAULT NOW() WITH TIME ZONE 'UTC' is not getting parsed to datetime.datetime with tzinfo. It basically ignores the tzinfo and returns a naive datetime when queried. Inserting an aware datetime is fine though.

Dominant language
Python
Stars
8.1k
Forks
469
Avg merge
2d 20h
Merged PRs (30d)
9

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MagicStack/asyncpg

All issues in MagicStack/asyncpg

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.