Postgres: prepared statement already exists
问题 I use Devise for authentication in my Rails API app. Sometimes I see following error in the logs: ActiveRecord::StatementInvalid: PGError: ERROR: prepared statement "a3926" already exists: UPDATE "users" SET "current_sign_in_at" = $1, "last_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "users"."id" = 12345 The error is coming out of Devise: def update_tracked_fields!(request) old_current, new_current = self.current_sign_in_at, Time.now.utc self.last_sign_in_at = old_current