pksunkara/pgx_ulid

Testing on M1 - pg_test_ulid_to_timestamp mismatch

Closed this issue · 2 comments


running 13 tests
    Building extension with features pg_test pg15
     Running command "/opt/homebrew/Cellar/rust/1.74.0/bin/cargo" "build" "--features" "pg_test pg15" "--no-default-features" "--message-format=json-render-diagnostics"
  Installing extension
     Copying control file to /Users/orefalo/GitRepositories/pgrx/15.5/pgrx-install/share/postgresql/extension/ulid.control
     Copying shared library to /Users/orefalo/GitRepositories/pgrx/15.5/pgrx-install/lib/postgresql/ulid.so
    Finished installing ulid
The files belonging to this database system will be owned by user "orefalo".
This user must also own the server process.

The database cluster will be initialized with this locale configuration:
  provider:    libc
  LC_COLLATE:  C
  LC_CTYPE:    UTF-8
  LC_MESSAGES: C
  LC_MONETARY: C
  LC_NUMERIC:  C
  LC_TIME:     C
The default database encoding has accordingly been set to "UTF8".
initdb: could not find suitable text search configuration for locale "UTF-8"
The default text search configuration will be set to "simple".

Data page checksums are disabled.

creating directory /Users/orefalo/GitRepositories/pgx_ulid/target/pgrx-test-data-15 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Dubai
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /Users/orefalo/GitRepositories/pgrx/15.5/pgrx-install/bin/pg_ctl -D /Users/orefalo/GitRepositories/pgx_ulid/target/pgrx-test-data-15 -l logfile start

test tests::pg_test_timestamp_to_ulid ... ok
test tests::pg_test_ulid_to_string ... ok
test tests::pg_test_ulid_to_uuid ... ok
test tests::pg_test_null_to_ulid ... ok
test tests::pg_test_string_to_ulid_lowercase ... ok
test tests::pg_test_string_to_ulid ... ok
test tests::pg_test_generate ... ok
test tests::pg_test_commutator ... ok
test tests::pg_test_hash ... ok
test tests::pg_test_uuid_to_ulid ... ok
test tests::pg_test_string_to_ulid_invalid_length - should panic ... ok
test tests::pg_test_string_to_ulid_invalid_char - should panic ... ok
test tests::pg_test_ulid_to_timestamp ... FAILED

failures:

---- tests::pg_test_ulid_to_timestamp stdout ----
thread 'tests::pg_test_ulid_to_timestamp' panicked at /Users/orefalo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-tests-0.11.1/src/framework.rs:172:9:


Postgres Messages:
[2023-11-28 11:19:17.139 +04] [66984] [65659475.105a8]: LOG:  starting PostgreSQL 15.5 on aarch64-apple-darwin23.1.0, compiled by Apple clang version 15.0.0 (clang-1500.0.40.1), 64-bit
[2023-11-28 11:19:17.140 +04] [66984] [65659475.105a8]: LOG:  listening on IPv6 address "::1", port 32215
[2023-11-28 11:19:17.140 +04] [66984] [65659475.105a8]: LOG:  listening on IPv4 address "127.0.0.1", port 32215
[2023-11-28 11:19:17.140 +04] [66984] [65659475.105a8]: LOG:  listening on Unix socket "/Users/orefalo/GitRepositories/pgrx/.s.PGSQL.32215"
[2023-11-28 11:19:17.144 +04] [66984] [65659475.105a8]: LOG:  database system is ready to accept connections


Test Function Messages:
[2023-11-28 11:19:18.652 +04] [67071] [65659476.105ff]: LOG:  statement: BEGIN
[2023-11-28 11:19:18.652 +04] [67071] [65659476.105ff]: LOG:  statement: SELECT "tests"."test_ulid_to_timestamp"();
[2023-11-28 11:19:18.653 +04] [67071] [65659476.105ff]: ERROR:  assertion `left == right` failed
[2023-11-28 11:19:18.653 +04] [67071] [65659476.105ff]: STATEMENT:  SELECT "tests"."test_ulid_to_timestamp"();
[2023-11-28 11:19:18.653 +04] [67071] [65659476.105ff]: LOG:  statement: ROLLBACK


Client Error:
assertion `left == right` failed
  left: Some("2023-03-10 12:00:49.111")
 right: Some("2023-03-10 16:00:49.111")
postgres location: lib.rs
rust location: <unknown>

Not sure if it's related to M1.

that's the query that fails - SELECT '{TIMESTAMP}'::timestamp::ulid::text;

hum.. I wonder if it's not a timezone issue.

It is!!
added "set timezone TO 'UTC';" to the test query to fix, will submit PR