PostgreSQL: CreationDateTime and LastUpdateToPayPerRequestDateTime carry microseconds, where DynamoDB sends milliseconds

Aperta Adatta ai principianti
#1,036 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, rust
Ambito
databases

Direzione di ricerca

Leggi crates/storage-postgres/src/create_table.rs, crates/storage-postgres/src/table_helpers.rs e crates/storage-postgres/src/delete_table.rs, concentrandoti sulle query che estraggono creation_date_time come secondi dall’epoca. Tronca i risultati di queste query ai millisecondi, come propone l’issue, e controlla i test PostgreSQL che coprono le risposte di CreateTable, DescribeTable, UpdateTable e DeleteTable. Il lavoro è completato quando queste date hanno al massimo tre cifre decimali, anche per le tabelle create prima della modifica.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

On the PostgreSQL backend, CreateTable, DescribeTable and UpdateTable send CreationDateTime as epoch seconds with microseconds. DescribeTable sends the same value as BillingModeSummary.LastUpdateToPayPerRequestDateTime. Amazon DynamoDB sends every date member as epoch seconds with at most three decimal places.

Measured in us-east-1 on 2026-11-14 and 2026-11-16, with each response body read as text. On 2026-11-14 each request went out twice, and every date member of both answers had three decimal places. The requests were a CreateTable of an on-demand table (pk S HASH, BillingMode PAY_PER_REQUEST), a DescribeTable once it was ACTIVE, and a CreateBackup of it. A second table got a CreateTable with ProvisionedThroughput 5/7, then an UpdateTable that raised it to 9/11. DynamoDB writes the numbers in exponent form. The ExtendDB column gives the numbers as ExtendDB sent them on PostgreSQL:

Member DynamoDB, 2026-11-14 ExtendDB on PostgreSQL
CreateTable TableDescription.CreationDateTime 1.794674022596E9 1794835907.194914
DescribeTable Table.CreationDateTime 1.794674022596E9 1794835907.194914
DescribeTable Table.BillingModeSummary.LastUpdateToPayPerRequestDateTime 1.794674022596E9 1794835907.194914
CreateBackup BackupDetails.BackupCreationDateTime 1.794674033829E9 1794835908.235
UpdateTable TableDescription.CreationDateTime of the second table 1.794674033901E9 1794835908.25337

ExtendDB at origin/main 95425f5e8 gives these answers on PostgreSQL. A second run gave 1794836584.375861 and 1794836585.48558. The other backends send at most three decimal places: SQLite, SQLite in dev mode and MongoDB send whole seconds, and Cassandra sends milliseconds (1794836695.516).

create_table.rs (crates/storage-postgres/src/create_table.rs) stores creation_date_time as NOW() (line 262) in a TIMESTAMPTZ column (crates/storage-postgres/migrations/0001_baseline.sql, line 40), which keeps microseconds. The insert returns EXTRACT(EPOCH FROM creation_date_time)::FLOAT8 (line 269). build_table_description_on (crates/storage-postgres/src/table_helpers.rs, line 133) reads the column the same way at line 142, and build_table_description_from_row (line 190) copies the value into LastUpdateToPayPerRequestDateTime at line 306. The DeleteTable query reads it the same way (crates/storage-postgres/src/delete_table.rs, line 49). BackupCreationDateTime has three decimal places because pg_timestamp_to_epoch (crates/storage-postgres/src/backup_engine.rs, line 56) converts a whole-millisecond instant as milliseconds over 1000, and a backup's creation time is a whole millisecond.

Proposed change: truncate the creation time to the millisecond in the three queries that read it, for example EXTRACT(EPOCH FROM date_trunc('milliseconds', creation_date_time))::FLOAT8. Tables created before the change then also answer with at most three decimal places.

Lingua principale
Rust
Stelle
517
Fork
60
Merge medio
5g 14h
PR unite (30g)
124

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ExtendDB/extenddb

Tutte le issue di ExtendDB/extenddb

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.