I stumbled onto a strange timezone bug while running tests. It could very well be my install of Go. I'm running 1.2rc5 on darwin_amd64. I'll see what I can dig up tomorrow, but I figured I'd write down my notes.
I expanded the test to add some debugging info.
-- FAIL: TestFindOrCreate (0.01 seconds)
gorm_test.go:1071: tmp={13 -0001-12-31 18:09:24 -0409 -0409 33 find or create 2013-11-23 22:48:56.622898 -0600 -0600 2013-11-23 22:48:56.6229 -0600 -0600 -0001-12-31 18:09:24 -0409 -0409 [] {0 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC} {0 false} {0 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC} 0 {0 {0 false} 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC} [] 0}
gorm_test.go:1078: Error: pq: invalid input syntax for type timestamp with time zone: "-0001-12-31T18:09:24-04:09"
gorm_test.go:1083: user should be found and updated with assigned attrs
FAIL
sql601.851usINSERT INTO users (birthday,age,deleted_at,password_hash,name,created_at,updated_at,billing_address_id,shipping_address_id) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING "id"[0001-01-01 00:00:00 +0000 UTC 33 0001-01-01 00:00:00 +0000 UTC [] find or create 2013-11-23 22:57:58.690353832 -0600 CST 2013-11-23 22:57:58.690355235 -0600 CST {0 false} 0]
...
sql253.948usUPDATE users SET birthday = $1, age = $2, name = $3, created_at = $4, updated_at = $5, deleted_at = $6, shipping_address_id = $7, password_hash = $8, billing_address_id = $9 WHERE (deleted_at IS NULL OR deleted_at <= '0001-01-02') AND (id = $10) AND ((name = $11))[-0001-12-31 18:09:24 -0409 -0409 44 find or create 2013-11-23 22:57:58.690354 -0600 -0600 2013-11-23 22:57:58.698527043 -0600 CST -0001-12-31 18:09:24 -0409 -0409 0 [] {0 false} 13 find or create]
...
sql246.245usUPDATE users SET age = $1, updated_at = $2, deleted_at = $3, password_hash = $4, birthday = $5, name = $6, created_at = $7, billing_address_id = $8, shipping_address_id = $9 WHERE (deleted_at IS NULL OR deleted_at <= '0001-01-02') AND (id = $10) AND ((name = $11))[44 2013-11-23 22:38:37.686012577 -0600 CST -0001-12-31 18:09:24 -0409 -0409 [] -0001-12-31 18:09:24 -0409 -0409 find or create 2013-11-23 22:38:37.679395 -0600 -0600 {0 false} 0 13 find or create]
gorm=# select * from users where name='find or create';
-[ RECORD 1 ]-------+--------------------------------
id | 13
birthday | 0001-12-31 18:09:24-05:50:36 BC
age | 33
name | find or create
created_at | 2013-11-23 22:45:33.268583-06
updated_at | 2013-11-23 22:45:33.268584-06
deleted_at | 0001-12-31 18:09:24-05:50:36 BC
billing_address_id |
shipping_address_id | 0
password_hash | \x
Quite a few deleted_at dates have a strange timezone like this (all but one). I'll see what I can dig up tomorrow, but I'm going to crash for tonight.
I think I might also look at checking for query errors in tests. I think this is happening on the products table as well.