Skip to content

Docs for https://github.com/pgdogdev/pgdog/pull/1541 - #114

Merged
jkaczman merged 2 commits into
mainfrom
jk-omni-writes-1541
Sep 16, 2026
Merged

jkaczman merged 2 commits into
mainfrom
jk-omni-writes-1541

Conversation

@jkaczman

Copy link
Copy Markdown
Contributor

No description provided.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 15, 2026

Copy link
Copy Markdown

Deploying pgdog-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8706997
Status: ✅  Deploy successful!
Preview URL: https://25092acf.pgdog-docs.pages.dev
Branch Preview URL: https://jk-omni-writes-1541.pgdog-docs.pages.dev

View logs

jkaczman added a commit to pgdogdev/pgdog that referenced this pull request Sep 16, 2026
…1541)

When we perform an `INSERT` into an omnisharded table, right now, the
functions within the statement (or `COLUMN_DEFAULT` in the table schema)
are executed separately on each shard. In the case of time/date
functions, this means that they will drift slightly apart, as their
execution time will not be the exact same.

To fix this, this PR re-writes all those time/date functions ([Postgres
ref](https://www.postgresql.org/docs/current/functions-datetime.html)),
specifically: `current_date`, `current_time`, `current_timestamp`,
`clock_timestamp`, `localtime`, `localtimestamp`, `now`,
`statement_timestamp`, `timeofday`, and `transaction_timestamp`.

It handles both calls within a `VALUES` list, as well as is compatible
with functions specified within `COLUMN_DEFAULT` in the table schema.
It's also compatible with simple protocol, extended protocol, and
prepare/execute.

Refactoring:
- Pushed `TransactionType` into a `Transaction` type, so that the time
the transaction started could be saved for use with now() / other
functions that rely on transaction start time.
- Created a `PreparedPlan` type to encapsulate everything the
PreparedStatement cache stores for Prepare statements (instead of
passing around separate fields in a tuple).
- Pushed `GeneratedId` and its corresponding parameter number into a
`GeneratedParam` type.

Shortfalls:
- If the client specified a timezone, it only works with strings like
"UTC" and "America/New_York"; Postgres supports other types such as
`INTERVAL '-08:00' HOUR TO MINUTE`. Right now it errors to prevent
incorrect behavior falling through. We previously didn't support any
kind of timezone parsing whatsoever.

Docs: pgdogdev/docs#114.
Helm: pgdogdev/helm#140.
Fixes #1521.

@levkk levkk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perfect!

@levkk

levkk commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

The CI failed the first time because the enterprise image didn't have the config change yet. We're basically testing all documented configs against the latest EE image to make sure they are valid.

@jkaczman
jkaczman merged commit f435d85 into main Sep 16, 2026
2 of 3 checks passed
@jkaczman
jkaczman deleted the jk-omni-writes-1541 branch September 16, 2026 19:11
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.

2 participants