Refactor StringInfo usage in subscriptioncmds.c - Mailing list pgsql-hackers

From Mats Kindahl
Subject Refactor StringInfo usage in subscriptioncmds.c
Date
Msg-id 0b381b02-cab9-41f9-a900-ad6c8d26c1fc@gmail.com
Whole thread Raw
Responses Re: Refactor StringInfo usage in subscriptioncmds.c
Re: Refactor StringInfo usage in subscriptioncmds.c
List pgsql-hackers
Hi all,

As discussed in [1] the functions check_publications_origin_tables() and 
check_publications_origin_sequences() are building error messages using 
dynamically allocated StringInfo instances only to avoid duplicating a 
call of ereport().

Attached is a proposal that instead of building error message and hints 
dynamically, it will use ereport() directly and as a result does not 
have to allocate the error message strings and error message hints 
dynamically and these can be removed.

This also means that a previous use of gettext() (in the form of the "_" 
macro) is not needed any more and we can use errmsg() and errhint() 
rather than errmsg_internal() and errhint_internal() with ereport().

It also replaces the usage a dynamically allocated StringInfo of 
pubnames containing the publication names with a stack allocated 
StringInfoData, along the same line as in [2].

[1]: 
https://www.postgresql.org/message-id/CAApHDvrZnM28wa2VY58cvtY0y9XbMhKJH4m%3Dga3c1wfsx%3DMF4Q%40mail.gmail.com

[2]: 

https://www.postgresql.org/message-id/flat/CAApHDvrZnM28wa2VY58cvtY0y9XbMhKJH4m%3Dga3c1wfsx%3DMF4Q%40mail.gmail.com#ba34970e59f9fd847f1ab52777d57edc

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue
Next
From: David Rowley
Date:
Subject: Some efforts to get rid of "long" in our codebase