我在Heroku上使用Postgres Hobby版本。
网站上的特定操作会检查产品和类别表中是否存在特定项目及其类别,如果不可用,则将它们插入到同一个表格中。
此过程在localhost上顺利运行,但在Heroku上失败。事务在Begin之后立即回滚。以下是Heroku日志中的示例 -
2017-06-22T07:44:34.376911+00:00 app[web.1]: [93df2c3b-5573-4b9f-aee9-42983913bbd4] [1m[36mCategory Load (1.2ms)[0m [1m[34mSELECT "categories".* FROM "categories" WHERE "categories"."category_name" = $1 LIMIT $2[0m [["category_name", "Sports"], ["LIMIT", 1]]
2017-06-22T07:44:34.378385+00:00 app[web.1]: [93df2c3b-5573-4b9f-aee9-42983913bbd4] [1m[36mProduct Load (0.7ms)[0m [1m[34mSELECT "products".* FROM "products" WHERE "products"."asin" = $1 LIMIT $2[0m [["asin", "B00O0UUK74"], ["LIMIT", 1]]
2017-06-22T07:44:34.379228+00:00 app[web.1]: [93df2c3b-5573-4b9f-aee9-42983913bbd4] [1m[36mCACHE (0.0ms)[0m [1m[34mSELECT "categories".* FROM "categories" WHERE "categories"."category_name" = $1 LIMIT $2[0m [["category_name", "Sports"], ["LIMIT", 1]]
2017-06-22T07:44:34.380159+00:00 app[web.1]: [93df2c3b-5573-4b9f-aee9-42983913bbd4] [1m[35m (0.5ms)[0m [1m[35mBEGIN[0m
2017-06-22T07:44:34.381849+00:00 app[web.1]: [93df2c3b-5573-4b9f-aee9-42983913bbd4] [1m[35m (0.5ms)[0m [1m[31mROLLBACK[0m