Re: Skipping schema changes in publication
| От | Shlok Kyal |
|---|---|
| Тема | Re: Skipping schema changes in publication |
| Дата | |
| Msg-id | CANhcyEWGiWwGt1-v6d9bCAae9Np7cNPt+iRV9PXBZ0z=75XEVw@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Skipping schema changes in publication (Peter Smith <smithpb2250@gmail.com>) |
| Ответы |
Re: Skipping schema changes in publication
|
| Список | pgsql-hackers |
On Fri, 7 Nov 2025 at 11:36, Peter Smith <smithpb2250@gmail.com> wrote: > > Hi Shlok. > > Some questions for the patch v25-0002 (EXCEPT tables) > > ====== > doc/src/sgml/ref/alter_publication.sgml > > 1. > +ALTER PUBLICATION <replaceable class="parameter">name</replaceable> > ADD ALL TABLES [ EXCEPT [ TABLE ] ( <replaceable > class="parameter">exception_object</replaceable> [, ... ] ) ] > > You can do both ADD/SET the <publication_object>, so really there > should be an ADD/SET ALL TABLES command as well, right? > These patches only added the ADD ALL TABLES command. I think once the ADD ALL TABLES patch is committed, we can add the syntax SET ALL TABLES. > ~~~ > > 2. > What was your reason for changing the syntax? > AFAICT those added "( )" are not strictly necessary, so I just > wondered your reason. > > For example, we do not have any "( )" for <publication_object> [,...]. > It is: ALTER PUBLICATION name ADD publication_object [, ...] > Not: ALTER PUBLICATION name ADD (publication_object [, ...]) > > So in the same way we could have EXCEPT syntax like that: > ALTER PUBLICATION name ADD ALL TABLES [EXCEPT <table_exception_object> [, ...]] > Where table_exception_object is: [ TABLE ] [ ONLY ] table_name [ * ] > > Currently, if the user just wants to exclude a single table they must do: > ALTER PUBLICATION name ADD ALL TABLES EXCEPT (t1); > instead of just ALTER PUBLICATION name ADD ALL TABLES EXCEPT t1; > With recent commit now we support CREATE PUBLICATION .. FOR ALL TABLES, ALL SEQUENCES. Now when I am trying to support "FOR ALL TABLE EXCEPT t1, t2" , I am getting a conflict when compiling this grammar. For example CREATE PUBLICATION .. FOR ALL TABLES EXCEPT t1, ... After this comma, bison is giving conflict because it is not able to figure whether to pick ExceptPublicationObjSpec or a PublicationAllObjSpec. So to handle this I introduced brackets around the table list. And to make ALTER PUBLICATION similar to CREATE PUBLICATION, I have added the same syntax for it. So current syntax for CREATE/ALTER PUBLICATION is like: CREATE PUBLICATION ... ALL TABLES EXCEPT TABLE(t1, t2, t3); ALTER PUBLICATION ... ADD ALL TABLES EXCEPT TABLE(t1, t2, t3); > ~~~ > > 3. > BTW, I think you may need to consider a <table_exception_object> > instead of a generic name like <exception_object>, because in the > future if we EXCEPT SEQUENCES the <exception_object> name may be not > appropriate because things like [ONLY] and [*] are not applicable for > sequences. Fixed I have attached the latest patch here. I have also addressed the comments for [1], [2]. [1]: https://www.postgresql.org/message-id/CALDaNm0xDv96F%2B5LzcJYV6RC3Jg%2BRtdUqpQ-zoauwq3woTFzmQ%40mail.gmail.com [2]: https://www.postgresql.org/message-id/CAHut+PsRD8ybC7MDBNBXXs=J2DuGiOc8kSePRyZc0s63U5f7tw@mail.gmail.com Thanks, Shlok Kyal
Вложения
В списке pgsql-hackers по дате отправления: