I went and had another look at this. The patch has been around for 18 commitfests and is widely considered to add a good feature, so it seems about time to get reach closure.
As I've mentioned in the past I'm not a big fan of the parser, but the thread has overruled on that. Another thing I think is a bit overcomplicated is the layered error handling for printing log messages, and bubbling up of errors to get around not being able to call exit_nicely. In the attached version I've boiled down the error logging into a single new function pg_log_filter_error() which takes a variable format string. This removes a fair bit of the extra calls and makes logging easier. I've also added a function pointer to the FilterStateData for passing the exit function via filter_init. This allows the filtering code to exit gracefully regardless of which application is using it. Finally, I've also reimplemented the logic for checking the parsed tokens into switch statements without defaults in order to get the compilerwarning on a missed case. It's easy to miss adding code to handle a state, especially when adding new ones, and this should help highlight that. Overall, this does shave a bit off the patch in size for what IMHO is better readability and maintainability. (I've also made a pgindent pass over it of course). What are your thoughts on this version? It's not in a committable state as it needs a bit more comments here and there and a triplecheck that nothing was missed in changing this, but I prefer to get your thoughts before spending the extra time. -- Daniel Gustafsson
v20231109-0001-possibility-to-read-options-for-dump-from-.patch
Description: Binary data