Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

DATETIME(n) / TIMESTAMP(n) columns drop fractional seconds

Đang mở
#527 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
mysql, php, sqlite
Lĩnh vực
database

Hướng nghiên cứu

Start by tracing the write and comparison paths that cast DATETIME and TIMESTAMP values through SQLite's DATETIME(), then check how declared precision is represented. The report reproduces the issue with DATETIME(6) and provides a fractional-second equality query to use when investigating. Done means values retain the expected fractional seconds on read and comparisons against the inserted value match; the report leaves the implementation approach open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Reproduction

CREATE TABLE d (id INT, ts DATETIME(6));
INSERT INTO d (id, ts) VALUES (1, '2026-06-22 07:16:00.123456');
SELECT ts FROM d;
-- '2026-06-22 07:16:00'   (MySQL: '2026-06-22 07:16:00.123456')
SELECT COUNT(*) FROM d WHERE ts = '2026-06-22 07:16:00.123456';
-- 0                       (MySQL: 1)

Reproduced on trunk (3.1.0) with PHP 8.3 and SQLite 3.45.1.

Values written to DATETIME/TIMESTAMP columns are cast through SQLite's DATETIME(), which has no fractional part, so the column's declared precision is ignored. A value read back loses its fraction, and an equality or IN comparison against the value as written matches nothing. For example, an outbox that deletes processed rows by (id, queued_at) never deletes them.

Relation to #508

#508 adds MySQL-compatible date/time parsing and formatting, including fractional seconds, in the same code paths. Would you prefer this fixed on top of #508 (honoring DATETIME_PRECISION when casting on write, with MySQL's rounding or TIME_TRUNCATE_FRACTIONAL), or separately? I'm happy to contribute a PR in whichever direction fits.

Found while running WooCommerce on WordPress Playground.

Use of AI

This report was prepared with Claude Code.

Ngôn ngữ chính
PHP
Star
362
Fork
69
Merge trung bình
3 ngày 11 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của WordPress/sqlite-database-integration

Tất cả issue của WordPress/sqlite-database-integration

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.