TestHighBitHashRejectsUbigint documents that DuckDB's UBIGINT column rejects negative int64 values — this is the DuckDB behavior that motivated switching the query_log column to BIGINT. If a future DuckDB version changes this behavior (e.g., bitwise reinterpretation), this test failing means the col
(t *testing.T)
| 219 | // FNV-1a produces uint64 values; ~50% have the high bit set, which |
| 220 | // becomes negative when stored as int64. Verify BIGINT accepts these. |
| 221 | var highBitHash int64 = -0x2900_0000_0000_0000 // equivalent to uint64(0xD700_0000_0000_0000) |
| 222 | |
| 223 | _, err = db.Exec("INSERT INTO test_hash VALUES ($1)", highBitHash) |
| 224 | if err != nil { |
| 225 | t.Fatalf("insert failed (this was the original bug): %v", err) |
| 226 | } |
| 227 | |
| 228 | var stored int64 |
| 229 | err = db.QueryRow("SELECT h FROM test_hash").Scan(&stored) |
| 230 | if err != nil { |
| 231 | t.Fatalf("query failed: %v", err) |
| 232 | } |
| 233 | if stored != highBitHash { |
| 234 | t.Errorf("hash round-trip mismatch: got %d, want %d", stored, highBitHash) |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // TestHighBitHashRejectsUbigint documents that DuckDB's UBIGINT column rejects |
| 239 | // negative int64 values — this is the DuckDB behavior that motivated switching |
| 240 | // the query_log column to BIGINT. If a future DuckDB version changes this |
| 241 | // behavior (e.g., bitwise reinterpretation), this test failing means the column |
| 242 | // type choice should be re-evaluated, not that duckgres has regressed. |