index d61b290d2a62e119b4d5432af13d3130298a2d51..b961a24b36dd1ae76e9234a88339a23f5d52620d 100644 (file)
{
if (AH->connection)
{
- size_t res;
+ int res;
res = lo_write(AH->connection, AH->loFd, AH->lo_buf, AH->lo_buf_used);
- pg_log_debug(ngettext("wrote %lu byte of large object data (result = %lu)",
- "wrote %lu bytes of large object data (result = %lu)",
+ pg_log_debug(ngettext("wrote %zu byte of large object data (result = %d)",
+ "wrote %zu bytes of large object data (result = %d)",
AH->lo_buf_used),
- (unsigned long) AH->lo_buf_used, (unsigned long) res);
+ AH->lo_buf_used, res);
+ /* We assume there are no short writes, only errors */
if (res != AH->lo_buf_used)
- fatal("could not write to large object (result: %lu, expected: %lu)",
- (unsigned long) res, (unsigned long) AH->lo_buf_used);
+ warn_or_exit_horribly(AH, "could not write to large object: %s",
+ PQerrorMessage(AH->connection));
}
else
{