Thread: Proposal to have INCLUDE/EXCLUDE options for altering option values
Hi PostgreSQL Community,
Recently I have been working on foreign servers regarding my project and wanted to add some extensions in server options to support query pushdown. For this, suppose I had 20 extensions in the beginning I used ALTER SERVER srv OPTIONS (ADD EXTENSIONS 'all 20 extensions'), then again, I had to add a few or drop some, I had to write names of all the 20 extensions including/excluding some.
I wonder why we can't have some sort of INCLUDE / EXCLUDE option for this use case that can be useful for other options as well which have comma-separated values. I believe this is a useful feature to have for the users.
Since I needed that support, I took the initiative to contribute to the community. In addition, I have improved the documentation too as currently while reading the documentation it looks like ADD can be used multiple times even to include some values on top of existing values.
Attached is the patch for the same. Looking forward to your feedback.
Regards
Ayush Vatsa
Amazon Web Services (AWS)
Recently I have been working on foreign servers regarding my project and wanted to add some extensions in server options to support query pushdown. For this, suppose I had 20 extensions in the beginning I used ALTER SERVER srv OPTIONS (ADD EXTENSIONS 'all 20 extensions'), then again, I had to add a few or drop some, I had to write names of all the 20 extensions including/excluding some.
I wonder why we can't have some sort of INCLUDE / EXCLUDE option for this use case that can be useful for other options as well which have comma-separated values. I believe this is a useful feature to have for the users.
Since I needed that support, I took the initiative to contribute to the community. In addition, I have improved the documentation too as currently while reading the documentation it looks like ADD can be used multiple times even to include some values on top of existing values.
Attached is the patch for the same. Looking forward to your feedback.
Regards
Ayush Vatsa
Amazon Web Services (AWS)
Attachment
Added a CF entry for the same - https://commitfest.postgresql.org/48/4955/
Regards
Ayush Vatsa
Amazon Web Services (AWS)
On Fri, 26 Apr 2024 at 11:05, Ayush Vatsa <ayushvatsa1810@gmail.com> wrote:
Hi PostgreSQL Community,
Recently I have been working on foreign servers regarding my project and wanted to add some extensions in server options to support query pushdown. For this, suppose I had 20 extensions in the beginning I used ALTER SERVER srv OPTIONS (ADD EXTENSIONS 'all 20 extensions'), then again, I had to add a few or drop some, I had to write names of all the 20 extensions including/excluding some.
I wonder why we can't have some sort of INCLUDE / EXCLUDE option for this use case that can be useful for other options as well which have comma-separated values. I believe this is a useful feature to have for the users.
Since I needed that support, I took the initiative to contribute to the community. In addition, I have improved the documentation too as currently while reading the documentation it looks like ADD can be used multiple times even to include some values on top of existing values.
Attached is the patch for the same. Looking forward to your feedback.
Regards
Ayush Vatsa
Amazon Web Services (AWS)
On Mon, Aug 26, 2024 at 12:34 PM Ayush Vatsa <ayushvatsa1810@gmail.com> wrote: > I noticed that my last commit needs rebase through cfbot - http://cfbot.cputube.org/ayush-vatsa.html > PFA the rebased patch for the same. Hi Ayush, Thanks for working on this. One problem that I notice is that your documentation changes seem to suppose that all options are lists, but actually most of them aren't, and these new variants wouldn't be applicable to non-list cases. They also suppose that everybody's using comma-separated lists specifically, but that's not required and some extensions might be doing something different. Also, I'm not convinced that this problem would arise often enough in practice that it's worth adding a feature to address it. A user who has this problem can pretty easily do some scripting to address it - e.g. SELECT the current option value, split it on commas, add or remove whatever, and then SET the new option value. If that were something lots of users were doing all the time, then I think it might make a lot of sense to have a built-in solution to make it easier, but I doubt that's the case. -- Robert Haas EDB: http://www.enterprisedb.com
On Mon, Aug 26, 2024, at 1:34 PM, Ayush Vatsa wrote:
I noticed that my last commit needs rebase through cfbot - http://cfbot.cputube.org/ayush-vatsa.htmlPFA the rebased patch for the same.
There is no list concept for OPTIONS. What happen if you use it in a non-list
value?
ALTER SERVER foo OPTIONS(ADD bar '1');
ALTER SERVER foo OPTIONS(REMOVE bar '1');
Error? Remove option 'bar'?
This proposal is not idempotent. It means that at the end of the SQL commands,
the final state is not predictable. That's disappointed since some tools rely on
this property to create migration scripts.
The syntax is not SQL standard. It does not mean that we cannot extend the
standard but sometimes it is a sign that it is not very useful or the current syntax
already covers all cases.
AFAICS this proposal also represents a tiny use case. The options to define a
foreign server don't generally include a list as value. And if so, it is not
common to change the foreign server options.
I also think that REMOVE is a synonym for DROP. It would be confuse to explain
that REMOVE is for list elements and DROP is for the list.
I'm not convinced that this new syntax improves the user experience.
> I'm not convinced
> that this problem would arise often enough in practice that it's worth
> adding a feature to address it. A user who has this problem can pretty
> easily do some scripting to address it
Thanks Robert and Euler for the feedback.
> that this problem would arise often enough in practice that it's worth
> adding a feature to address it. A user who has this problem can pretty
> easily do some scripting to address it
> AFAICS this proposal also represents a tiny use case.
Thanks Robert and Euler for the feedback.
Ack, Initially while working on the solution I thought this can be a common
problem. But I agree if the use case is small we can postpone supporting
such syntax for the future.
I can then withdraw the patch.
I can then withdraw the patch.
Regards
Ayush Vatsa
AWS