Re: issue in pgfdw_report_error()?

2021-12-03 Thread Fujii Masao
On 2021/11/22 13:59, Bharath Rupireddy wrote: On Mon, Nov 22, 2021 at 8:17 AM Fujii Masao wrote: Well, in that case, why can't we get rid of "(message_primary != NULL" and just have "message_primary[0] != '\0' ? errmsg_internal("%s", message_primary) : errmsg("could not obtain message

Re: issue in pgfdw_report_error()?

2021-11-21 Thread Bharath Rupireddy
On Mon, Nov 22, 2021 at 8:17 AM Fujii Masao wrote: > > Well, in that case, why can't we get rid of "(message_primary != NULL" > > and just have "message_primary[0] != '\0' ? errmsg_internal("%s", > > message_primary) : errmsg("could not obtain message string for remote > > error")" ? > > That's

Re: issue in pgfdw_report_error()?

2021-11-21 Thread Fujii Masao
On 2021/11/20 1:16, Bharath Rupireddy wrote: With the existing code, it emits "" for message_primary[0] == '\0' cases but with the patch it emits "could not obtain message string for remote error". Yes. Well, in that case, why can't we get rid of "(message_primary != NULL" and just have

Re: issue in pgfdw_report_error()?

2021-11-19 Thread Bharath Rupireddy
On Fri, Nov 19, 2021 at 8:48 PM Fujii Masao wrote: > > On 2021/11/19 21:57, Bharath Rupireddy wrote: > >> If this is a bug, IMO the following change needs to be applied. Thought? > >> > >> --- > >> ereport(elevel, > >>

Re: issue in pgfdw_report_error()?

2021-11-19 Thread Fujii Masao
On 2021/11/19 21:57, Bharath Rupireddy wrote: If this is a bug, IMO the following change needs to be applied. Thought? --- ereport(elevel, (errcode(sqlstate), -message_primary ?

Re: issue in pgfdw_report_error()?

2021-11-19 Thread Bharath Rupireddy
On Fri, Nov 19, 2021 at 1:48 PM Fujii Masao wrote: > > Hi, > > pgfdw_report_error() in postgres_fdw is implemented to report the message > "could not obtain ..." if message_primary is NULL as follows. > But, just before this ereport(), message_primary is set to > pchomp(PQerrorMessage()) if it's

issue in pgfdw_report_error()?

2021-11-19 Thread Fujii Masao
Hi, pgfdw_report_error() in postgres_fdw is implemented to report the message "could not obtain ..." if message_primary is NULL as follows. But, just before this ereport(), message_primary is set to pchomp(PQerrorMessage()) if it's NULL. So ISTM that message_primary is always not NULL in