Hi PostgreSQL Community, I would like to provide an update on the patch I previously submitted, along with a clearer explanation of the issue it addresses and the improvements it introduces. Current Issue: PostgreSQL currently supports several options with actions like ADD, SET, and DROP for foreign servers, user mappings, foreign tables, etc. For example, the syntax for modifying a server option is as follows:
ALTER SERVER name [ VERSION 'new_version' ] [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) ] However, there is a limitations with the current approach: If a user wants to add new values to an existing option, they can use: ALTER SERVER foo OPTIONS (ADD extensions 'ext1,ext2'); But when modifying existing values, users must repeat all the existing values along with the new ones: ALTER SERVER foo OPTIONS (ADD extensions 'ext1,ext2'); ALTER SERVER foo OPTIONS (SET extensions 'ext1,ext2,ext3'); This repetition can be cumbersome and error-prone when there are large number of comma separated values. Proposed Solution: To address this, I propose introducing two new actions: APPEND and REMOVE. These will allow users to modify existing values without needing to repeat all current entries. ALTER SERVER foo OPTIONS (APPEND extensions 'ext4,ext5,ext6'); --extensions will be like 'ext1,ext2,ext3,ext4,ext5,ext6' ALTER SERVER foo OPTIONS (REMOVE extensions 'ext1'); --extensions will be like 'ext2,ext4,ext5,ext6' I had an off-site discussion with Nathan Bossart (bossartn) and have incorporated his feedback about changing actions name to be more clear into the updated patch. Furthermore, I noticed that the documentation for the existing actions could be clearer, so I have revised it as well. The documentation for the newly proposed actions is included in a separate patch. Looking forward to your comments and feedback. Regards Ayush Vatsa AWS
v2-0001-Enhance-ALTER-statement-with-extended-support-for.patch
Description: Binary data
v2-0002-fix-alter_server-alter_foreign_data_wrapper-alter.patch
Description: Binary data