2018-07-25 11:09 GMT+02:00 Amit Langote <langote_amit...@lab.ntt.co.jp>:

> Hi Pavel.
>
> On 2018/07/23 20:46, Pavel Stehule wrote:
> > Hi
> >
> > I am sending a prototype of patch. Now, it calculates size of partitioned
> > tables with recursive query. When any more simple method will be
> possible,
> > the size calculation will be changed.
> >
> > postgres=# \dt+
> >                        List of relations
> > +--------+------------+-------+-------+---------+-------------+
> > | Schema |    Name    | Type  | Owner |  Size   | Description |
> > +--------+------------+-------+-------+---------+-------------+
> > | public | data       | table | pavel | 0 bytes |             |
> > | public | data_2016  | table | pavel | 15 MB   |             |
> > | public | data_2017  | table | pavel | 15 MB   |             |
> > | public | data_other | table | pavel | 11 MB   |             |
> > +--------+------------+-------+-------+---------+-------------+
> > (4 rows)
> >
> > postgres=# \dP+
> >           List of partitioned tables
> > +--------+------+-------+-------+-------------+
> > | Schema | Name | Owner | Size  | Description |
> > +--------+------+-------+-------+-------------+
> > | public | data | pavel | 42 MB |             |
> > +--------+------+-------+-------+-------------+
> > (1 row)
>
> This looks nice, although I haven't looked at the patch yet.  Also, as you
> said, we could later replace the method of directly querying pg_inherits
> by something else.
>
> > p.s. Another patch can be replacement of relation type from "table" to
> > "partitioned table"
> >
> > postgres=# \dt+
> >                              List of relations
> > +--------+------------+-------------------+-------+---------
> +-------------+
> > | Schema |    Name    |       Type        | Owner |  Size   |
> Description |
> > +--------+------------+-------------------+-------+---------
> +-------------+
> > | public | data       | partitioned table | pavel | 0 bytes |
>  |
> > | public | data_2016  | table             | pavel | 15 MB   |
>  |
> > | public | data_2017  | table             | pavel | 15 MB   |
>  |
> > | public | data_other | table             | pavel | 11 MB   |
>  |
> > +--------+------------+-------------------+-------+---------
> +-------------+
> > (4 rows)
> >
> > A patch is simple for this case
> >
> > diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
> > index c3bdf8555d..491e58eb29 100644
> > --- a/src/bin/psql/describe.c
> > +++ b/src/bin/psql/describe.c
> > @@ -3490,8 +3490,8 @@ listTables(const char *tabtypes, const char
> *pattern,
> > bool verbose, bool showSys
> >                       gettext_noop("sequence"),
> >                       gettext_noop("special"),
> >                       gettext_noop("foreign table"),
> > -                     gettext_noop("table"),    /* partitioned table */
> > -                     gettext_noop("index"),    /* partitioned index */
> > +                     gettext_noop("partitioned table"),    /*
> partitioned
> > table */
> > +                     gettext_noop("partitioned index"),    /*
> partitioned
> > index */
> >                       gettext_noop("Type"),
> >                       gettext_noop("Owner"));
>
> Inclined to +1 this, too.  Although, one might ask why partitioned tables
> are called so only in the psql's output, but not in the backend's error
> messages, for example, as was discussed in the past.
>

i think so error messages is different chapter - it means revision of all
error messages, and probably somewhere the name of partition, and not
partition table can be correct.

Personally I am not sure about benefit to change error messages. Now, the
partition is table too, so the error messages are not strongly wrong.

Regards

Pavel



> Thanks,
> Amit
>
>

Reply via email to