pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump of partitioned table not working.
20+ messages / 4 participants
[nested] [flat]

* pg_dump of partitioned table not working.
@ 2020-12-02 23:27 Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 3 replies; 20+ messages in thread

From: Ron @ 2020-12-02 23:27 UTC (permalink / raw)
  To: pgsql-general

What am I missing?

(Specifying the whole file name because multiple versions are installed.)

$ /usr/lib/postgresql/12/bin/pg_dump --version
pg_dump (PostgreSQL) 12.5 (Ubuntu 12.5-1.pgdg18.04+1)

postgres=# \d+ measurement
                            Partitioned table "public.measurement"
   Column   |  Type   | Collation | Nullable | Default | Storage | Stats 
target | Description
-----------+---------+-----------+----------+---------+---------+--------------+-------------
  city_id   | integer |           | not null |         | plain   
|              |
  logdate   | date    |           | not null |         | plain   
|              |
  peaktemp  | integer |           |          |         | plain   
|              |
  unitsales | integer |           |          |         | plain   
|              |
Partition key: RANGE (logdate)
Indexes:
     "measurement_pkey" PRIMARY KEY, btree (city_id, logdate)
Partitions: measurement_y2019h1 FOR VALUES FROM ('2019-01-01') TO 
('2019-07-01'),
             measurement_y2019h2 FOR VALUES FROM ('2019-07-01') TO 
('2020-01-01'),
             measurement_y2020h1 FOR VALUES FROM ('2020-01-01') TO 
('2020-07-01'),
             measurement_y2020h2 FOR VALUES FROM ('2020-07-01') TO 
('2021-01-01')

postgres=# select * from measurement;
  city_id |  logdate   | peaktemp | unitsales
---------+------------+----------+-----------
        5 | 2019-05-03 |          |
        5 | 2020-11-22 |       77 |        45
        4 | 2020-11-22 |       77 |        45
(3 rows)

$ /usr/lib/postgresql/12/bin/pg_dump -p5433 -d postgres -t measurement 
--data-only
--
-- PostgreSQL database dump
--

-- Dumped from database version 12.5 (Ubuntu 12.5-1.pgdg18.04+1)
-- Dumped by pg_dump version 12.5 (Ubuntu 12.5-1.pgdg18.04+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- PostgreSQL database dump complete
--



-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-02 23:35 ` David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2 siblings, 1 reply; 20+ messages in thread

From: David G. Johnston @ 2020-12-02 23:35 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general

On Wednesday, December 2, 2020, Ron <ronljohnsonjr@gmail.com> wrote:

> What am I missing?
>
> (Specifying the whole file name because multiple versions are installed.)
>
> $ /usr/lib/postgresql/12/bin/pg_dump --version
> pg_dump (PostgreSQL) 12.5 (Ubuntu 12.5-1.pgdg18.04+1)
>
> postgres=# \d+ measurement
>
>

psql? on (default) port 5432




> $ /usr/lib/postgresql/12/bin/pg_dump -p5433 -d postgres -t measurement
> --data-only
>
>
 pg_dump on port 5433

Usually different ports means different clusters

David J.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
@ 2020-12-03 00:06   ` Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:08     ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Ron @ 2020-12-03 00:06 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 5:35 PM, David G. Johnston wrote:
> On Wednesday, December 2, 2020, Ron <ronljohnsonjr@gmail.com 
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>     What am I missing?
>
>     (Specifying the whole file name because multiple versions are installed.)
>
>     $ /usr/lib/postgresql/12/bin/pg_dump --version
>     pg_dump (PostgreSQL) 12.5 (Ubuntu 12.5-1.pgdg18.04+1)
>
>     postgres=# \d+ measurement
>
>
> psql? on (default) port 5432
>
>
>     $ /usr/lib/postgresql/12/bin/pg_dump -p5433 -d postgres -t measurement
>     --data-only
>
>
>  pg_dump on port 5433
>
> Usually different ports means different clusters

That's right.  What's your point?

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-03 00:08     ` David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:13       ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: David G. Johnston @ 2020-12-03 00:08 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general

On Wed, Dec 2, 2020 at 5:06 PM Ron <ronljohnsonjr@gmail.com> wrote:

> On 12/2/20 5:35 PM, David G. Johnston wrote:
>
> On Wednesday, December 2, 2020, Ron <ronljohnsonjr@gmail.com> wrote:
>
>> What am I missing?
>>
>> (Specifying the whole file name because multiple versions are installed.)
>>
>> $ /usr/lib/postgresql/12/bin/pg_dump --version
>> pg_dump (PostgreSQL) 12.5 (Ubuntu 12.5-1.pgdg18.04+1)
>>
>> postgres=# \d+ measurement
>>
>>
>
> psql? on (default) port 5432
>
>
>
>
>> $ /usr/lib/postgresql/12/bin/pg_dump -p5433 -d postgres -t measurement
>> --data-only
>>
>>
>  pg_dump on port 5433
>
> Usually different ports means different clusters
>
>
> That's right.  What's your point?
>
>
That you were comparing apples and oranges - specifically that the database
you were dumping was empty but the one you were checking was not.

David J.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:08     ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
@ 2020-12-03 00:13       ` Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:21         ` Re: pg_dump of partitioned table not working. Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Ron @ 2020-12-03 00:13 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 6:08 PM, David G. Johnston wrote:
> On Wed, Dec 2, 2020 at 5:06 PM Ron <ronljohnsonjr@gmail.com 
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>     On 12/2/20 5:35 PM, David G. Johnston wrote:
>>     On Wednesday, December 2, 2020, Ron <ronljohnsonjr@gmail.com
>>     <mailto:ronljohnsonjr@gmail.com>> wrote:
>>
>>         What am I missing?
>>
>>         (Specifying the whole file name because multiple versions are
>>         installed.)
>>
>>         $ /usr/lib/postgresql/12/bin/pg_dump --version
>>         pg_dump (PostgreSQL) 12.5 (Ubuntu 12.5-1.pgdg18.04+1)
>>
>>         postgres=# \d+ measurement
>>
>>
>>     psql? on (default) port 5432
>>
>>
>>         $ /usr/lib/postgresql/12/bin/pg_dump -p5433 -d postgres -t
>>         measurement --data-only
>>
>>
>>      pg_dump on port 5433
>>
>>     Usually different ports means different clusters
>
>     That's right.  What's your point?
>
>
> That you were comparing apples and oranges - specifically that the 
> database you were dumping was empty but the one you were checking was not.
>

While I could have shown the exact psql commands 
(/usr/lib/postgresql/12/bin/psql -p5433) it wasn't necessary.

I know that was the command, because I use a set of aliases:

alias pgdump12='/usr/lib/postgresql/12/bin/pg_dump -p5433'
alias pgdump96='/usr/lib/postgresql/9.6/bin/pg_dump -p5432'
alias pgrestore12='/usr/lib/postgresql/12/bin/pg_restore -p5433'
alias pgrestore96='/usr/lib/postgresql/9.6/bin/pg_restore -p5432'
alias psql12='/usr/lib/postgresql/12/bin/psql -p5433'
alias psql96='/usr/lib/postgresql/9.6/bin/psql -p5432'

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:08     ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:13       ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-03 00:21         ` Adrian Klaver <adrian.klaver@aklaver.com>
  2020-12-03 00:38           ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Adrian Klaver @ 2020-12-03 00:21 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; pgsql-general

On 12/2/20 4:13 PM, Ron wrote:
> On 12/2/20 6:08 PM, David G. Johnston wrote:
>> On Wed, Dec 2, 2020 at 5:06 PM Ron <ronljohnsonjr@gmail.com 
>> <mailto:ronljohnsonjr@gmail.com>> wrote:

>> That you were comparing apples and oranges - specifically that the 
>> database you were dumping was empty but the one you were checking was not.
>>
> 
> While I could have shown the exact psql commands 
> (/usr/lib/postgresql/12/bin/psql -p5433) it wasn't necessary.

 From the POV of the mailing list participants it was necessary as the 
below constitutes hidden information we didn't have access to. When 
presenting a issue explicit is better then implicit. I cannot count the 
number of times issues where solved on this list when someone got around 
to asking for a explicit command.

> 
> I know that was the command, because I use a set of aliases:
> 
> alias pgdump12='/usr/lib/postgresql/12/bin/pg_dump -p5433'
> alias pgdump96='/usr/lib/postgresql/9.6/bin/pg_dump -p5432'
> alias pgrestore12='/usr/lib/postgresql/12/bin/pg_restore -p5433'
> alias pgrestore96='/usr/lib/postgresql/9.6/bin/pg_restore -p5432'
> alias psql12='/usr/lib/postgresql/12/bin/psql -p5433'
> alias psql96='/usr/lib/postgresql/9.6/bin/psql -p5432'
> 
> -- 
> Angular momentum makes the world go 'round.


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:08     ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:13       ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:21         ` Re: pg_dump of partitioned table not working. Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-12-03 00:38           ` Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:52             ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:54             ` Re: pg_dump of partitioned table not working. Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 2 replies; 20+ messages in thread

From: Ron @ 2020-12-03 00:38 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 6:21 PM, Adrian Klaver wrote:
> On 12/2/20 4:13 PM, Ron wrote:
>> On 12/2/20 6:08 PM, David G. Johnston wrote:
>>> On Wed, Dec 2, 2020 at 5:06 PM Ron <ronljohnsonjr@gmail.com 
>>> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>>> That you were comparing apples and oranges - specifically that the 
>>> database you were dumping was empty but the one you were checking was not.
>>>
>>
>> While I could have shown the exact psql commands 
>> (/usr/lib/postgresql/12/bin/psql -p5433) it wasn't necessary.
>
> From the POV of the mailing list participants it was necessary as the 
> below constitutes hidden information we didn't have access to. When 
> presenting a issue explicit is better then implicit. I cannot count the 
> number of times issues where solved on this list when someone got around 
> to asking for a explicit command.

Shame on me for assuming, based on the explicit pg_dump command in the example.

>
>>
>> I know that was the command, because I use a set of aliases:
>>
>> alias pgdump12='/usr/lib/postgresql/12/bin/pg_dump -p5433'
>> alias pgdump96='/usr/lib/postgresql/9.6/bin/pg_dump -p5432'
>> alias pgrestore12='/usr/lib/postgresql/12/bin/pg_restore -p5433'
>> alias pgrestore96='/usr/lib/postgresql/9.6/bin/pg_restore -p5432'
>> alias psql12='/usr/lib/postgresql/12/bin/psql -p5433'
>> alias psql96='/usr/lib/postgresql/9.6/bin/psql -p5432'
>>
>> -- 
>> Angular momentum makes the world go 'round.
>
>

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:08     ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:13       ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:21         ` Re: pg_dump of partitioned table not working. Adrian Klaver <adrian.klaver@aklaver.com>
  2020-12-03 00:38           ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-03 00:52             ` David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 20+ messages in thread

From: David G. Johnston @ 2020-12-03 00:52 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general

On Wed, Dec 2, 2020 at 5:38 PM Ron <ronljohnsonjr@gmail.com> wrote:

> Shame on me for assuming, based on the explicit pg_dump command in the
> example.
>
>
This is what you wrote: >
> (Specifying the whole file name because multiple versions are installed.)

The path of the executable doesn't generally make a difference here

> $ /usr/lib/postgresql/12/bin/pg_dump --version
> pg_dump (PostgreSQL) 12.5 (Ubuntu 12.5-1.pgdg18.04+1)

Your 5432 database...

> postgres=# \d+ measurement

No idea how you got to this psql prompt, the last command you showed
doesn't give you one.  Not going to assume this isn't "one of the other of
the multiple versions you have installed".
Then you show that your 5432 database has data.

> pg_dump -p 5433

Your dump of your 5433 database doesn't have data..

Typos or otherwise, the imprecise nature of your example drew attention to
a possible typo-related problem, as opposed to the true "partitioned table"
problem.

The fact that you didn't ask a better (more specific question), or
otherwise state your expectations (which I presume would have pointed out
the partitioned table dynamic) didn't help.

Sure, I could have been more careful in my reviewing of the posted material
and made more of an effort to figure out what is correct, what is wrong,
and what is confusing you.  But this is also best-effort, and typos end up
being the solution often enough that I don't usually dive deeper until that
is ruled out (though here I did register the partitioned table aspect
eventually).

David J.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:08     ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:13       ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:21         ` Re: pg_dump of partitioned table not working. Adrian Klaver <adrian.klaver@aklaver.com>
  2020-12-03 00:38           ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-03 00:54             ` Adrian Klaver <adrian.klaver@aklaver.com>
  2020-12-03 01:39               ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  1 sibling, 1 reply; 20+ messages in thread

From: Adrian Klaver @ 2020-12-03 00:54 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; pgsql-general

On 12/2/20 4:38 PM, Ron wrote:
> On 12/2/20 6:21 PM, Adrian Klaver wrote:
>> On 12/2/20 4:13 PM, Ron wrote:
>>> On 12/2/20 6:08 PM, David G. Johnston wrote:
>>>> On Wed, Dec 2, 2020 at 5:06 PM Ron <ronljohnsonjr@gmail.com 
>>>> <mailto:ronljohnsonjr@gmail.com>> wrote:
>>
>>>> That you were comparing apples and oranges - specifically that the 
>>>> database you were dumping was empty but the one you were checking 
>>>> was not.
>>>>
>>>
>>> While I could have shown the exact psql commands 
>>> (/usr/lib/postgresql/12/bin/psql -p5433) it wasn't necessary.
>>
>> From the POV of the mailing list participants it was necessary as the 
>> below constitutes hidden information we didn't have access to. When 
>> presenting a issue explicit is better then implicit. I cannot count 
>> the number of times issues where solved on this list when someone got 
>> around to asking for a explicit command.
> 
> Shame on me for assuming, based on the explicit pg_dump command in the 
> example.

The implied part was this:

postgres=# \d+ measurement

There was no indication of how you got there. You knew but we didn't and 
given how many times it has happened that folks where looking at one 
instance in one part of their problem report and another instance in 
separate part of the report it is only prudent to ask.

> 
>>
>>>
>>> I know that was the command, because I use a set of aliases:
>>>
>>> alias pgdump12='/usr/lib/postgresql/12/bin/pg_dump -p5433'
>>> alias pgdump96='/usr/lib/postgresql/9.6/bin/pg_dump -p5432'
>>> alias pgrestore12='/usr/lib/postgresql/12/bin/pg_restore -p5433'
>>> alias pgrestore96='/usr/lib/postgresql/9.6/bin/pg_restore -p5432'
>>> alias psql12='/usr/lib/postgresql/12/bin/psql -p5433'
>>> alias psql96='/usr/lib/postgresql/9.6/bin/psql -p5432'
>>>
>>> -- 
>>> Angular momentum makes the world go 'round.
>>
>>
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:35 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:06   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:08     ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:13       ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:21         ` Re: pg_dump of partitioned table not working. Adrian Klaver <adrian.klaver@aklaver.com>
  2020-12-03 00:38           ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:54             ` Re: pg_dump of partitioned table not working. Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-12-03 01:39               ` Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Ron @ 2020-12-03 01:39 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 6:54 PM, Adrian Klaver wrote:
> On 12/2/20 4:38 PM, Ron wrote:
>> On 12/2/20 6:21 PM, Adrian Klaver wrote:
>>> On 12/2/20 4:13 PM, Ron wrote:
>>>> On 12/2/20 6:08 PM, David G. Johnston wrote:
>>>>> On Wed, Dec 2, 2020 at 5:06 PM Ron <ronljohnsonjr@gmail.com 
>>>>> <mailto:ronljohnsonjr@gmail.com>> wrote:
>>>
>>>>> That you were comparing apples and oranges - specifically that the 
>>>>> database you were dumping was empty but the one you were checking was 
>>>>> not.
>>>>>
>>>>
>>>> While I could have shown the exact psql commands 
>>>> (/usr/lib/postgresql/12/bin/psql -p5433) it wasn't necessary.
>>>
>>> From the POV of the mailing list participants it was necessary as the 
>>> below constitutes hidden information we didn't have access to. When 
>>> presenting a issue explicit is better then implicit. I cannot count the 
>>> number of times issues where solved on this list when someone got around 
>>> to asking for a explicit command.
>>
>> Shame on me for assuming, based on the explicit pg_dump command in the 
>> example.
>
> The implied part was this:
>
> postgres=# \d+ measurement
>
> There was no indication of how you got there. You knew but we didn't and 
> given how many times it has happened that folks where looking at one 
> instance in one part of their problem report and another instance in 
> separate part of the report it is only prudent to ask.

You're absolutely right.  Like I said, shame on me.

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-02 23:42 ` Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-02 23:49   ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-02 23:50   ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2 siblings, 2 replies; 20+ messages in thread

From: Tom Lane @ 2020-12-02 23:42 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general

Ron <ronljohnsonjr@gmail.com> writes:
> What am I missing?

There's no data in a partitioned table per se, so the result is
not surprising.

What you need here is something like "pg_dump -t measurement*"
to indicate that you want measurement's child tables too, but
AFAIR pg_dump has no such feature.  Maybe we should add it.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-12-02 23:49   ` David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:09     ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  1 sibling, 1 reply; 20+ messages in thread

From: David G. Johnston @ 2020-12-02 23:49 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-general

On Wednesday, December 2, 2020, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>
> What you need here is something like "pg_dump -t measurement*"
> to indicate that you want measurement's child tables too, but
> AFAIR pg_dump has no such feature.


 -t accepts a pattern in pg_dump.  But that requires the user to adhere to
a naming scheme.  There is room for a long-form argument in a similar vein
to
--load-via-partition-root
to export through partition root.

David J.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-02 23:49   ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
@ 2020-12-03 00:09     ` Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Ron @ 2020-12-03 00:09 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 5:49 PM, David G. Johnston wrote:
> On Wednesday, December 2, 2020, Tom Lane <tgl@sss.pgh.pa.us 
> <mailto:tgl@sss.pgh.pa.us>> wrote:
>
>
>     What you need here is something like "pg_dump -t measurement*"
>     to indicate that you want measurement's child tables too, but
>     AFAIR pg_dump has no such feature.
>
>
>  -t accepts a pattern in pg_dump.  But that requires the user to adhere to 
> a naming scheme.

Not only adhering to a naming scheme, but ensuring that there aren't any 
other tables which match "measurement*".

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-12-02 23:50   ` Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-03 00:14     ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  1 sibling, 1 reply; 20+ messages in thread

From: Tom Lane @ 2020-12-02 23:50 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general

I wrote:
> What you need here is something like "pg_dump -t measurement*"
> to indicate that you want measurement's child tables too, but
> AFAIR pg_dump has no such feature.  Maybe we should add it.

Or actually: that syntax does do something, but it selects
tables by pattern matching not hierarchy, ie you get everything
whose name starts with "measurement".  Depending on your naming
conventions, that might be close enough.

It does seem like there might be reason to have a switch along
the lines of "--include-child-tables".

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-02 23:50   ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-12-03 00:14     ` Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:21       ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 01:51       ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  0 siblings, 2 replies; 20+ messages in thread

From: Ron @ 2020-12-03 00:14 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 5:50 PM, Tom Lane wrote:
> I wrote:
>> What you need here is something like "pg_dump -t measurement*"
>> to indicate that you want measurement's child tables too, but
>> AFAIR pg_dump has no such feature.  Maybe we should add it.
> Or actually: that syntax does do something, but it selects
> tables by pattern matching not hierarchy, ie you get everything
> whose name starts with "measurement".  Depending on your naming
> conventions, that might be close enough.
>
> It does seem like there might be reason to have a switch along
> the lines of "--include-child-tables".

That would be great, but won't help me in v12.


-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-02 23:50   ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-03 00:14     ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-03 00:21       ` David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:36         ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  1 sibling, 1 reply; 20+ messages in thread

From: David G. Johnston @ 2020-12-03 00:21 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general

On Wed, Dec 2, 2020 at 5:14 PM Ron <ronljohnsonjr@gmail.com> wrote:

>
> > It does seem like there might be reason to have a switch along
> > the lines of "--include-child-tables".
>
> That would be great, but won't help me in v12.
>
>
I'd probably just relocate the table to a separate schema and require that
all partitions are placed there as well.  Otherwise, the necessary
information exists in the catalogs, so a solution is within reach (minor
concern regarding concurrency).

David J.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-02 23:50   ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-03 00:14     ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-03 00:21       ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
@ 2020-12-03 00:36         ` Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Ron @ 2020-12-03 00:36 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 6:21 PM, David G. Johnston wrote:
> On Wed, Dec 2, 2020 at 5:14 PM Ron <ronljohnsonjr@gmail.com 
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>
>     > It does seem like there might be reason to have a switch along
>     > the lines of "--include-child-tables".
>
>     That would be great, but won't help me in v12.
>
>
> I'd probably just relocate the table to a separate schema and require that 
> all partitions are placed there as well.  Otherwise, the necessary 
> information exists in the catalogs, so a solution is within reach (minor 
> concern regarding concurrency).

That's doable, but the developer (of the very large mission-critical 
*existing application*) would probably push back.

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-02 23:50   ` Re: pg_dump of partitioned table not working. Tom Lane <tgl@sss.pgh.pa.us>
  2020-12-03 00:14     ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-03 01:51       ` Ron <ronljohnsonjr@gmail.com>
  1 sibling, 0 replies; 20+ messages in thread

From: Ron @ 2020-12-03 01:51 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 6:14 PM, Ron wrote:
> On 12/2/20 5:50 PM, Tom Lane wrote:
>> I wrote:
>>> What you need here is something like "pg_dump -t measurement*"
>>> to indicate that you want measurement's child tables too, but
>>> AFAIR pg_dump has no such feature.  Maybe we should add it.
>> Or actually: that syntax does do something, but it selects
>> tables by pattern matching not hierarchy, ie you get everything
>> whose name starts with "measurement".  Depending on your naming
>> conventions, that might be close enough.
>>
>> It does seem like there might be reason to have a switch along
>> the lines of "--include-child-tables".
>
> That would be great, but won't help me in v12.

To clarify: I'm not being sarcastic.  Such a feature really would be useful.

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
@ 2020-12-02 23:42 ` David G. Johnston <david.g.johnston@gmail.com>
  2020-12-03 00:05   ` Re: pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2 siblings, 1 reply; 20+ messages in thread

From: David G. Johnston @ 2020-12-02 23:42 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general

On Wednesday, December 2, 2020, Ron <ronljohnsonjr@gmail.com> wrote:

> What am I missing?
>
> postgres=# \d+ measurement
>                            Partitioned table "public.measurement"
>
>
> $ /usr/lib/postgresql/12/bin/pg_dump -p5433 -d postgres -t measurement
> --data-only
>

I’m unsure whether to expect a dump of only the partitioned table’s data to
be empty or include everything.  I suspect “empty” is the correct answer.
If you dump everything the individual tables would be dumped, and not all
partition should be dumped.

David J.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pg_dump of partitioned table not working.
  2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
  2020-12-02 23:42 ` Re: pg_dump of partitioned table not working. David G. Johnston <david.g.johnston@gmail.com>
@ 2020-12-03 00:05   ` Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Ron @ 2020-12-03 00:05 UTC (permalink / raw)
  To: pgsql-general

On 12/2/20 5:42 PM, David G. Johnston wrote:
> On Wednesday, December 2, 2020, Ron <ronljohnsonjr@gmail.com 
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>     What am I missing?
>
>     postgres=# \d+ measurement
>                                Partitioned table "public.measurement"
>
>
>     $ /usr/lib/postgresql/12/bin/pg_dump -p5433 -d postgres -t measurement
>     --data-only
>
>
> I’m unsure whether to expect a dump of only the partitioned table’s data 
> to be empty or include everything.  I suspect “empty” is the correct 
> answer.  If you dump everything the individual tables would be dumped, and 
> not all partition should be dumped.

The individual partition tables regularly (for some site-specific definition 
of "regularly") change, as new partitions are added and old partitions are 
dropped.  Or the DBA decides to change the partition scheme.

Needing to remember all the partition names is absurd, especially when there 
might be dozens of them

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 20+ messages in thread


end of thread, other threads:[~2020-12-03 01:51 UTC | newest]

Thread overview: 20+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 23:27 pg_dump of partitioned table not working. Ron <ronljohnsonjr@gmail.com>
2020-12-02 23:35 ` David G. Johnston <david.g.johnston@gmail.com>
2020-12-03 00:06   ` Ron <ronljohnsonjr@gmail.com>
2020-12-03 00:08     ` David G. Johnston <david.g.johnston@gmail.com>
2020-12-03 00:13       ` Ron <ronljohnsonjr@gmail.com>
2020-12-03 00:21         ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-12-03 00:38           ` Ron <ronljohnsonjr@gmail.com>
2020-12-03 00:52             ` David G. Johnston <david.g.johnston@gmail.com>
2020-12-03 00:54             ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-12-03 01:39               ` Ron <ronljohnsonjr@gmail.com>
2020-12-02 23:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-12-02 23:49   ` David G. Johnston <david.g.johnston@gmail.com>
2020-12-03 00:09     ` Ron <ronljohnsonjr@gmail.com>
2020-12-02 23:50   ` Tom Lane <tgl@sss.pgh.pa.us>
2020-12-03 00:14     ` Ron <ronljohnsonjr@gmail.com>
2020-12-03 00:21       ` David G. Johnston <david.g.johnston@gmail.com>
2020-12-03 00:36         ` Ron <ronljohnsonjr@gmail.com>
2020-12-03 01:51       ` Ron <ronljohnsonjr@gmail.com>
2020-12-02 23:42 ` David G. Johnston <david.g.johnston@gmail.com>
2020-12-03 00:05   ` Ron <ronljohnsonjr@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox