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

Fixed RD-15252: Missing handling of TIMESTAMPTZOID #11

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bgaidioz
Copy link

@bgaidioz bgaidioz commented Dec 23, 2024

An expression like NOW() evaluates to a TIMESTAMPTZ which fails to be converted and is sent as a string.

The patch ensures it's processed like a timestamp and the query doesn't fail.

@@ -1805,6 +1805,7 @@ datumToPython(Datum datum, Oid type, ConversionInfo * cinfo)
return datumDecimalToPython(datum, cinfo);
case DATEOID:
return datumDateToPython(datum, cinfo);
case TIMESTAMPTZOID:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe Postgres stores a timestamp with time zone after having shifted it by its timezone offset. Does that mean we're getting a timestamp without timezone, but shifted?

PyDateTime_IMPORT;
timestamp2tm(DatumGetTimestampTz(datum), &tzp, pg_tm_value, &fsec,
&tzn, session_timezone);
result = PyDateTime_FromDateAndTime(pg_tm_value->tm_year,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to pass the timezone offset.

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