Thread: PQconnectdb/PQerrorMessage changed behavior on master

PQconnectdb/PQerrorMessage changed behavior on master

From
Alexander Lakhin
Date:
Hello,

While trying to use sqlsmith with postgres compiled from the master branch, I've found that the PQerrorMessage() function now returns non-informational but not empty error message after the successful PQconnectdb() call.
    conn = PQconnectdb(conninfo.c_str());
    char *errmsg = PQerrorMessage(conn);
returns
'connection to server on socket "/tmp/ody8OuOaqV/.s.PGSQL.59860" failed: '

The affected sqlsmith code:
https://github.com/anse1/sqlsmith/blob/master/postgres.cc#L305

Best regards,
Alexander

Re: PQconnectdb/PQerrorMessage changed behavior on master

From
Tom Lane
Date:
Alexander Lakhin <exclusion@gmail.com> writes:
> While trying to use sqlsmith with postgres compiled from the master
> branch, I've found that the PQerrorMessage() function now returns
> non-informational but not empty error message after the successful
> PQconnectdb() call.

Yeah, see thread here:

https://www.postgresql.org/message-id/20210506162651.GJ27406%40telsasoft.com

sqlsmith is definitely Doing It Wrong there, but there's a
reasonable question whether such coding is common.

            regards, tom lane



Re: PQconnectdb/PQerrorMessage changed behavior on master

From
Alexander Lakhin
Date:
27.06.2021 23:07, Tom Lane wrote:
>> While trying to use sqlsmith with postgres compiled from the master
>> branch, I've found that the PQerrorMessage() function now returns
>> non-informational but not empty error message after the successful
>> PQconnectdb() call.
> Yeah, see thread here:
>
> https://www.postgresql.org/message-id/20210506162651.GJ27406%40telsasoft.com
>
> sqlsmith is definitely Doing It Wrong there, but there's a
> reasonable question whether such coding is common.
Thanks for info! I agree that sqlsmith's check is incorrect, nonetheless
I was embarrassed by the incomplete error message.

Best regards,
Alexander