aboutsummaryrefslogtreecommitdiff
path: root/src/modules/extra/m_pgsql.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-12-02 21:16:19 +0000
committerGravatar Sadie Powell2025-12-02 21:17:24 +0000
commit52f0c9b2275d9af4a81d7d752535cf0cdb043fcd (patch)
tree6eb52d78d3eb082cd20a3071551071a0ff8e5bc0 /src/modules/extra/m_pgsql.cpp
parentUse windows-2025 for the Windows CI. (diff)
Strip all newline characters from the PostgreSQL error message.
Diffstat (limited to 'src/modules/extra/m_pgsql.cpp')
-rw-r--r--src/modules/extra/m_pgsql.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 70846d90e..309bcc9de 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -417,7 +417,10 @@ restart:
case PGRES_BAD_RESPONSE:
case PGRES_FATAL_ERROR:
{
- SQL::Error err(SQL::QREPLY_FAIL, PQresultErrorMessage(result));
+ std::string errmsg = PQresultErrorMessage(result);
+ for (size_t pos = 0; ((pos = errmsg.find_first_of("\r\n", pos)) != std::string::npos); )
+ errmsg[pos] = ' ';
+ SQL::Error err(SQL::QREPLY_FAIL, errmsg);
qinprog.c->OnError(err);
break;
}