Skip to content

Add integer_datetimes flag in connection parameters status, hardcoded to on#5103

Merged
renecannao merged 1 commit intov3.0from
v3.0_issue_5100
Sep 4, 2025
Merged

Add integer_datetimes flag in connection parameters status, hardcoded to on#5103
renecannao merged 1 commit intov3.0from
v3.0_issue_5100

Conversation

@rahim-kanji
Copy link
Collaborator

Details

  • PostgreSQL historically allowed date/time values to be represented in two ways:
    • 64-bit integers (int64) (microsecond precision)
    • 64-bit floating-point doubles (less precise)
  • In both cases, the payload is 8 bytes wide in binary format, but the interpretation depends on the integer_datetimes flag.
  • Connectors need the value of this flag to correctly decide how to decode the 8-byte payload.
  • In PostgreSQL versions before v10, the flag is not present, in which case the connector assumes value is in floating-point.
  • Since PostgreSQL 10, integer_datetimes is always compiled as on (64-bit integer). The GUC still exists but is fixed to on and cannot be disabled.

Closes #5100

…ded to on.

Added scram_iterations in ProxySQL staup parameters status, hardcoded to
4096 (SCRAM_SHA_256_DEFAULT_ITERATIONS)
@rahim-kanji rahim-kanji self-assigned this Sep 3, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @rahim-kanji, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates how ProxySQL communicates PostgreSQL server parameters to connecting clients. It ensures that the integer_datetimes flag is always reported as "on", aligning with PostgreSQL versions 10 and newer which exclusively use 64-bit integer representation for date/time values. Additionally, it introduces the scram_iterations parameter, providing clients with the default iteration count for SCRAM authentication. These changes improve compatibility and correct parameter reporting for PostgreSQL clients.

Highlights

  • PostgreSQL integer_datetimes flag: The integer_datetimes parameter status is now explicitly set to "on" during client welcome, reflecting modern PostgreSQL's default behavior where date/time values are always represented as 64-bit integers.
  • SCRAM Iterations: The scram_iterations parameter status is now explicitly set to "4096" during client welcome.
  • Code Cleanup: Removed previously commented-out code related to client_encoding and datestyle parameter status writes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 3, 2025

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds the integer_datetimes and scram_iterations startup parameters. The change for integer_datetimes is correct and aligns with modern PostgreSQL behavior. The implementation for scram_iterations uses a magic number, which could be a maintainability issue. I've added a review comment with a suggestion to improve this.

Comment on lines +1240 to +1241
// using SCRAM_SHA_256_DEFAULT_ITERATIONS value
pgpkt.write_ParameterStatus("scram_iterations", "4096");

Choose a reason for hiding this comment

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

medium

The hardcoded value "4096" is a magic number. This value corresponds to SCRAM_DEFAULT_ITERATIONS from libscram. If that constant ever changes, this hardcoded value will become stale, which could lead to authentication issues for clients that rely on this parameter. It would be better to define and use a constant for this value.

Also, the comment is slightly inaccurate. The constant in libscram is SCRAM_DEFAULT_ITERATIONS.

	// Report scram_iterations. This corresponds to SCRAM_DEFAULT_ITERATIONS from libscram.
	pgpkt.write_ParameterStatus("scram_iterations", "4096");

@rahim-kanji rahim-kanji changed the title Add integer_datetimes flag in ProxySQL startup parameters status, hardcoded to on Add integer_datetimes flag in connection startup parameters status, hardcoded to on Sep 3, 2025
@rahim-kanji rahim-kanji changed the title Add integer_datetimes flag in connection startup parameters status, hardcoded to on Add integer_datetimes flag in connection parameters status, hardcoded to on Sep 3, 2025
@renecannao renecannao merged commit 8a175b5 into v3.0 Sep 4, 2025
5 of 6 checks passed
@noizu noizu added this to the Release 3.0.3 milestone Sep 30, 2025
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.

3 participants