MagicStack / MagicStack/py-pgproto

timestamp_encode() raises an Exception when encoding timezone-aware datetimes

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Cython
Stars
38
Forks
21
PR merge metrics
No merged PRs in 30d

Description

When passing a timezone-aware datetime to timestamp_encode() an exception is raised when subtracting pg_epoch_datetime as is it timezone-naive.
I believe that in this case pg_epoch_datetime_utc should be subtracted instead.

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.

Research direction

Start at timestamp_encode() and inspect how pg_epoch_datetime and pg_epoch_datetime_utc are used when subtracting from timezone-aware datetimes. Confirm the fix by exercising timezone-aware input and verifying that encoding completes without the naive-versus-aware datetime exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.