Re: Option to dump foreign data in pg_dump

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Luis Carril <luis(dot)carril(at)swarm64(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Option to dump foreign data in pg_dump
Date: 2020-03-23 20:40:21
Message-ID: 20200323204021.GA15147@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

v8 attached.

I modified Luis' v7 a little bit by putting the ftserver acquisition in
the main pg_class query instead of adding one separate query for each
foreign table. That seems better overall.

I don't understand why this code specifically disallows the empty string
as an option to --dump-foreign-data. The other pattern-matching options
don't do that. This seems to have been added in response to Daniel's
review[1], but I don't quite understand the rationale. No other option
behaves that way. I'm inclined to remove that, and I have done so in
this version.

I removed DumpOptions new bool flag. Seems pointless; we can just check
that the list is not null, as we do for other such lists.

I split out the proposed test in a different commit; there's no
consensus that this test is acceptable as-is. Tom proposed a different
strategy[2]; if you try to dump a table with a dummy handler, you'll get
this:

COPY public.ft1 (c1, c2, c3) FROM stdin;
pg_dump: error: query failed: ERROR: foreign-data wrapper "dummy" has no handler
pg_dump: error: query was: COPY (SELECT c1, c2, c3 FROM public.ft1 ) TO stdout;

Maybe what we should do just verify that you do get that error (and no
other errors).

[1] https://postgr.es/m/E9C5B25C-52E4-49EC-9958-69CD5BD14EDA@yesql.se
[2] https://postgr.es/m/8001.1573759651@sss.pgh.pa.us

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v8-0001-pg_dump-Allow-dumping-data-of-specific-foreign-se.patch text/x-diff 14.5 KB
v8-0002-Add-tests.patch text/x-diff 11.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2020-03-23 20:55:11 Re: weird hash plan cost, starting with pg10
Previous Message Jeff Davis 2020-03-23 20:29:02 Re: Additional size of hash table is alway zero for hash aggregates