Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8997-0005hm-UA for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Nov 2016 17:09:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c8997-0000EC-Cy for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Nov 2016 17:09:45 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c8995-0000Cd-Ak for pgsql-hackers@postgresql.org; Sat, 19 Nov 2016 17:09:43 +0000 Received: from tamriel.snowman.net ([72.66.115.51]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c898y-0007Y9-L3 for pgsql-hackers@postgresql.org; Sat, 19 Nov 2016 17:09:41 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 55F4E5F7AA; Sat, 19 Nov 2016 12:08:35 -0500 (EST) Date: Sat, 19 Nov 2016 12:08:35 -0500 From: Stephen Frost To: pgsql-hackers@postgresql.org Subject: pg_dump -s -b Message-ID: <20161119170835.GZ13284@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4Ue0e0VusUZDyg9h" Content-Disposition: inline X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-91-generic (x86_64) X-Uptime: 11:55:21 up 133 days, 18:19, 25 users, load average: 0.02, 0.08, 0.12 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --4Ue0e0VusUZDyg9h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline All, While reviewing and considering the patch to add the --no-blobs option to pg_dump, which I entirely agree with, I came across our claim that passing -b to pg_dump would cause blobs to be output, regardless of other options set. To wit, our docs specifically say: ---- Include large objects in the dump. This is the default behavior except when --schema, --table, or --schema-only is specified, so the -b switch is only useful to add large objects to selective dumps. ---- However, a 'pg_dump -s -b' won't include blobs, which appears to be due to the masking performed in _tocEntryRequired() whereby we strip the REQ_DATA out if we are in schema-only mode. Further, though perhaps less surprising, we don't include blobs when --section=post-data is set, and only the definition of the blob (but no data) when --section=pre-data is used. This appears to go back at least as far as all currently supported branches. We have a few options here. The documentation says 'selective dumps', which we could infer to mean 'dumps where the user specified a table' or similar and exclude 'schema-only' from that case. I don't believe this was the original intent, given this comment in pg_dump.c: /* * Dumping blobs is now default unless we saw an inclusion switch or -s * ... but even if we did see one of these, -b turns it back on. */ Given the lack of field complaints about this, I'm pretty tempted to just adjust that comment and the documentation. Alternativly, we could hack things up in a simimlar manner to what was done in a7e5457, and cause blobs to be dumped even in schema-only mode if -b is passed. Thoughts? Thanks! Stephen --4Ue0e0VusUZDyg9h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJYMIcSAAoJEO1sijiDR2RVpQ4QAKbB3TP0aIZN2TWiSAo/PdVc V9NH/nM2BHuLiagXxJFsx4l76sBnAHC1lsSaaT1Or3CwFmczKx3lk72baNJYQWxl 0qm3QdLwKGmVv/YDxnfAxMYsqFDxGZV2LDqM16VYp3jaWeBkQUgCxjYFxwnQdg0R am6HK4T9/GgVe4tKOBG0UNRIFEVY1jDaGZlNH1gqnlNchXSjIneOa2FSNZfnrStI LaTYg8aZydSNfMjgEl45lbs/9AHBWWynooBb0TG62WkPltF8eiBDylPFZF7Y/Vuu 6iDDtlWgVNN242GX/CwTG9jRcefGquGM2Cs6L/yE4FaZ7d/N+YUEK5JH48QGykUw 9fGpMChsWBEB9qrnzxKo/3yf+tOh949wOYE8y9a7MjiSCItohhzvq7zYRtw1gG+o 96WKk4a+LosIP+es22pfcevjq98E9xfRra8uA8KoQHvgTE1dizD9dPSBTkX3jSmY 2imH7t+AQ8wRIMNgHYqvqoTp9WgVcCJG7FEga3BxWfCE+gaR6I7QXWhyN/YTA6sk QgFnSctXOvnU/07qXm1TsP8xNmrP6RNcEeCh1Pkzx0nTs6ndr1sw39Pzn553z6iE FKiicXPB1MfhNoLpDCFV6itKJo5g2J39z+vVy7DICaTed2KMxMzLObhm7IK7v2gL nXQ9YBMyHUPGgZHyjfpp =E/PY -----END PGP SIGNATURE----- --4Ue0e0VusUZDyg9h--