Thread: [HACKERS] logical replication: \dRp+ and "for all tables"

[HACKERS] logical replication: \dRp+ and "for all tables"

From
Jeff Janes
Date:
If I create a publication "for all tables", \dRp+ doesn't indicate it is for all tables, it just gives a list of the tables.  

So it doesn't distinguish between a publication specified to be for all tables (which will be dynamic regarding future additions), and one which just happens to include all the table which currently exist.

That seems unfortunate.  Should the "for all tables" be included as another column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?

Cheers,

Jeff




Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Masahiko Sawada
Date:
On Sat, Jun 10, 2017 at 7:29 AM, Jeff Janes <jeff.janes@gmail.com> wrote:
> If I create a publication "for all tables", \dRp+ doesn't indicate it is for
> all tables, it just gives a list of the tables.
>
> So it doesn't distinguish between a publication specified to be for all
> tables (which will be dynamic regarding future additions), and one which
> just happens to include all the table which currently exist.
>
> That seems unfortunate.  Should the "for all tables" be included as another
> column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?
>

+1. I was thinking the same. Attached patch adds "All Tables" column
to both \dRp and \dRp+.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Jeff Janes
Date:
On Fri, Jun 9, 2017 at 10:20 PM, Masahiko Sawada <sawada.mshk@gmail.com> wrote:
On Sat, Jun 10, 2017 at 7:29 AM, Jeff Janes <jeff.janes@gmail.com> wrote:
> If I create a publication "for all tables", \dRp+ doesn't indicate it is for
> all tables, it just gives a list of the tables.
>
> So it doesn't distinguish between a publication specified to be for all
> tables (which will be dynamic regarding future additions), and one which
> just happens to include all the table which currently exist.
>
> That seems unfortunate.  Should the "for all tables" be included as another
> column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?
>

+1. I was thinking the same. Attached patch adds "All Tables" column
to both \dRp and \dRp+.


Looks good to me.  Attached with regression test expected output  changes.

Cheers,

Jeff 
Attachment

Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Tom Lane
Date:
Jeff Janes <jeff.janes@gmail.com> writes:
> On Fri, Jun 9, 2017 at 10:20 PM, Masahiko Sawada <sawada.mshk@gmail.com>
> wrote:
>> On Sat, Jun 10, 2017 at 7:29 AM, Jeff Janes <jeff.janes@gmail.com> wrote:
>>> That seems unfortunate.  Should the "for all tables" be included as
>>> another column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?

>> +1. I was thinking the same. Attached patch adds "All Tables" column
>> to both \dRp and \dRp+.

> Looks good to me.  Attached with regression test expected output  changes.

This patch confuses me.  In the first place, I don't see the argument for
adding the "all tables" property to \dRp output; it seems out of place
there.  In the second place, this really fails to respond to what I'd call
the main usability problem with \dRp+, which is that the all-tables
property is likely to lead to an unreadably bulky list of affected tables.
What I'd say the patch ought to do is *replace* \dRp+'s list of affected
tables with a notation like "(all tables)" when puballtables is true.
        regards, tom lane



Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Masahiko Sawada
Date:
On Sat, Jun 10, 2017 at 11:42 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Jeff Janes <jeff.janes@gmail.com> writes:
>> On Fri, Jun 9, 2017 at 10:20 PM, Masahiko Sawada <sawada.mshk@gmail.com>
>> wrote:
>>> On Sat, Jun 10, 2017 at 7:29 AM, Jeff Janes <jeff.janes@gmail.com> wrote:
>>>> That seems unfortunate.  Should the "for all tables" be included as
>>>> another column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?
>
>>> +1. I was thinking the same. Attached patch adds "All Tables" column
>>> to both \dRp and \dRp+.
>
>> Looks good to me.  Attached with regression test expected output  changes.
>
> This patch confuses me.  In the first place, I don't see the argument for
> adding the "all tables" property to \dRp output; it seems out of place
> there.

I thought since "all tables" is also a primitive and frequently
accessed information we can add it to \dRp output. But I'm not sure
it's appropriate coping. Is there a criterion for what information we
should add to the "backslash" command or the "backslash+" command?

> In the second place, this really fails to respond to what I'd call
> the main usability problem with \dRp+, which is that the all-tables
> property is likely to lead to an unreadably bulky list of affected tables.
> What I'd say the patch ought to do is *replace* \dRp+'s list of affected
> tables with a notation like "(all tables)" when puballtables is true.
>

+1 for replacing it with "(al tables)" when puballtables is true.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center



Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Jeff Janes
Date:
On Sat, Jun 10, 2017 at 7:42 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Jeff Janes <jeff.janes@gmail.com> writes:
> On Fri, Jun 9, 2017 at 10:20 PM, Masahiko Sawada <sawada.mshk@gmail.com>
> wrote:
>> On Sat, Jun 10, 2017 at 7:29 AM, Jeff Janes <jeff.janes@gmail.com> wrote:
>>> That seems unfortunate.  Should the "for all tables" be included as
>>> another column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?

>> +1. I was thinking the same. Attached patch adds "All Tables" column
>> to both \dRp and \dRp+.

> Looks good to me.  Attached with regression test expected output  changes.

This patch confuses me.  In the first place, I don't see the argument for
adding the "all tables" property to \dRp output; it seems out of place
there. 

Why?  It is an important property of the publication which is single-valued and 
and easy to represent concisely.  What makes it out of place?
 
In the second place, this really fails to respond to what I'd call
the main usability problem with \dRp+, which is that the all-tables
property is likely to lead to an unreadably bulky list of affected tables.
What I'd say the patch ought to do is *replace* \dRp+'s list of affected
tables with a notation like "(all tables)" when puballtables is true.

I'd considered that, but I find the pager does a fine job of dealing with the bulkiness of the list. I thought it might be a good idea to not only point out that it is all tables, but also remind people of exactly what tables those are currently (in case it had slipped their mind that all tables will include table from other schemas not in their search_path, for example)

Cheers,

Jef

Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Tom Lane
Date:
Jeff Janes <jeff.janes@gmail.com> writes:
> On Sat, Jun 10, 2017 at 7:42 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> In the second place, this really fails to respond to what I'd call
>> the main usability problem with \dRp+, which is that the all-tables
>> property is likely to lead to an unreadably bulky list of affected tables.
>> What I'd say the patch ought to do is *replace* \dRp+'s list of affected
>> tables with a notation like "(all tables)" when puballtables is true.

> I'd considered that, but I find the pager does a fine job of dealing with
> the bulkiness of the list.

Have you tried it with a few tens of thousands of tables?  Even if your
pager makes it work comfortably, others might find it less satisfactory.

> I thought it might be a good idea to not only
> point out that it is all tables, but also remind people of exactly what
> tables those are currently (in case it had slipped their mind that all
> tables will include table from other schemas not in their search_path, for
> example)

I'm not really buying that.  If they don't know what "all tables" means,
a voluminous list isn't likely to help much.

I was hoping we'd get some more votes in this thread, but it seems like
we've only got three, and by my count two of them are for just printing
"all tables".
        regards, tom lane



Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
"David G. Johnston"
Date:
On Wed, Jun 14, 2017 at 4:10 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I was hoping we'd get some more votes in this thread, but it seems like
we've only got three, and by my count two of them are for just printing
"all tables".

The following looks right - given a publication it would nice to know if its for all tables or not.

  \dRp
!                                    List of publications
!         Name        |          Owner           | All Tables | Inserts | Updates | Deletes 
! --------------------+--------------------------+------------+---------+---------+---------
!  testpib_ins_trunct | regress_publication_user | f          | t       | f       | f
!  testpub_default    | regress_publication_user | f          | t       | t       | t
This [I couldn't find a regression diff entry where "All Tables" is true :( ...]

  \dRp+ testpub3
!            Publication testpub3
!  All Tables | Inserts | Updates | Deletes 
! ------------+---------+---------+---------
!  f          | t       | t       | t
  Tables:
      "public.testpub_tbl3"
      "public.testpub_tbl3a"

I agree with Tom and Masahiko Sawada, if "All Tables" is false we continue to show "Tables:\n\t[tables]" but when "All Tables" is true we'd write something like "Tables: All Tables in Database".  The user can query the database if they wish to know the names of all those tables exactly.

I suppose we could go further here, say by simplifying "public.tbl1, public.tbl2", when public only contains two tables, to "public.*".  Or consider never listing more than some small number of rows and provide a "show all" option (\dRp++ or just a function/view) that would list every single table.  But I would go with the default "+" behavior being to show table names when the listing of tables is fixed and to say "All Tables in Database" when it is dynamic.  In "+" mode that makes the "All Tables" boolean redundant though I'd keep it around for consistency.

David J.

Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Mark Kirkwood
Date:
On 15/06/17 11:10, Tom Lane wrote:

> Jeff Janes <jeff.janes@gmail.com> writes:
>> On Sat, Jun 10, 2017 at 7:42 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> In the second place, this really fails to respond to what I'd call
>>> the main usability problem with \dRp+, which is that the all-tables
>>> property is likely to lead to an unreadably bulky list of affected tables.
>>> What I'd say the patch ought to do is *replace* \dRp+'s list of affected
>>> tables with a notation like "(all tables)" when puballtables is true.
>> I'd considered that, but I find the pager does a fine job of dealing with
>> the bulkiness of the list.
> Have you tried it with a few tens of thousands of tables?  Even if your
> pager makes it work comfortably, others might find it less satisfactory.
>
>> I thought it might be a good idea to not only
>> point out that it is all tables, but also remind people of exactly what
>> tables those are currently (in case it had slipped their mind that all
>> tables will include table from other schemas not in their search_path, for
>> example)
> I'm not really buying that.  If they don't know what "all tables" means,
> a voluminous list isn't likely to help much.
>
> I was hoping we'd get some more votes in this thread, but it seems like
> we've only got three, and by my count two of them are for just printing
> "all tables".
>
>     

I'd certainly prefer to see 'all tables' - in addition to being more 
compact, it also reflects more correctly how the publication was defined.

regards

Mark




Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Peter Eisentraut
Date:
On 6/10/17 02:02, Jeff Janes wrote:
> On Fri, Jun 9, 2017 at 10:20 PM, Masahiko Sawada <sawada.mshk@gmail.com
> <mailto:sawada.mshk@gmail.com>> wrote:
> 
>     On Sat, Jun 10, 2017 at 7:29 AM, Jeff Janes <jeff.janes@gmail.com
>     <mailto:jeff.janes@gmail.com>> wrote:
>     > If I create a publication "for all tables", \dRp+ doesn't indicate it is for
>     > all tables, it just gives a list of the tables.
>     >
>     > So it doesn't distinguish between a publication specified to be for all
>     > tables (which will be dynamic regarding future additions), and one which
>     > just happens to include all the table which currently exist.
>     >
>     > That seems unfortunate.  Should the "for all tables" be included as another
>     > column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?
>     >
> 
>     +1. I was thinking the same. Attached patch adds "All Tables" column
>     to both \dRp and \dRp+.
> 
> 
> Looks good to me.  Attached with regression test expected output  changes.

I have committed your patch and removed the "Tables" footer for
all-tables publications, as was discussed later in the thread.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: [HACKERS] logical replication: \dRp+ and "for all tables"

From
Masahiko Sawada
Date:
On Thu, Jun 15, 2017 at 11:49 PM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> On 6/10/17 02:02, Jeff Janes wrote:
>> On Fri, Jun 9, 2017 at 10:20 PM, Masahiko Sawada <sawada.mshk@gmail.com
>> <mailto:sawada.mshk@gmail.com>> wrote:
>>
>>     On Sat, Jun 10, 2017 at 7:29 AM, Jeff Janes <jeff.janes@gmail.com
>>     <mailto:jeff.janes@gmail.com>> wrote:
>>     > If I create a publication "for all tables", \dRp+ doesn't indicate it is for
>>     > all tables, it just gives a list of the tables.
>>     >
>>     > So it doesn't distinguish between a publication specified to be for all
>>     > tables (which will be dynamic regarding future additions), and one which
>>     > just happens to include all the table which currently exist.
>>     >
>>     > That seems unfortunate.  Should the "for all tables" be included as another
>>     > column in \dRp and \dRp+, or at least as a footnote tag in \dRp+ ?
>>     >
>>
>>     +1. I was thinking the same. Attached patch adds "All Tables" column
>>     to both \dRp and \dRp+.
>>
>>
>> Looks good to me.  Attached with regression test expected output  changes.
>
> I have committed your patch and removed the "Tables" footer for
> all-tables publications, as was discussed later in the thread.

Thank you!

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center