pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Update pg_upgrade test for reg* to include regrole and regnamesp
Date: Tue, 27 Nov 2018 10:47:29 -0500
Message-ID: <2735.1543333649@sss.pgh.pa.us> (raw)
In-Reply-To: <6f5edd28-e55f-7399-d89c-d2d1ed2d1e51@2ndQuadrant.com>
References: <E1gRS1V-0007eS-1p@gemulon.postgresql.org>
	<8863.1543297423@sss.pgh.pa.us>
	<20181127063226.mpyijg3jwrmmm3rr@alap3.anarazel.de>
	<6f5edd28-e55f-7399-d89c-d2d1ed2d1e51@2ndQuadrant.com>

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> In any case, I think we will probably need to bite the bullet and have 
> pg_dump render LOs in OID order.

+1.  Looking at the relevant code:

    /*
     * Currently, we re-fetch all BLOB OIDs using a cursor.  Consider scanning
     * the already-in-memory dumpable objects instead...
     */
    if (fout->remoteVersion >= 90000)
        blobQry = "DECLARE bloboid CURSOR FOR SELECT oid FROM pg_largeobject_metadata";
    else
        blobQry = "DECLARE bloboid CURSOR FOR SELECT DISTINCT loid FROM pg_largeobject";

I suspect that the original expectation was that SELECT DISTINCT would
deliver the blob OIDs in sorted order, and nobody noticed when hash-based
DISTINCT broke that, and then the pg_largeobject_metadata patch figured
that it didn't need to preserve a guarantee that wasn't there.

We have taken pains in the past to ensure consistent dump ordering, and
it seems to me the lack of that here is just an oversight.  It's kinda
surprising that it hasn't bit us before.

> Not sure if that needs to be always on, 
> or an option.

We have no existing option that says "you can skip ordering my dump
consistently".  I see no need for one here.

The easy fix is to add "ORDER BY 1" to both of the above queries.
If anyone is concerned about the performance of that, they could
go try to do what the comment suggests, but I'm not personally
excited about that.

			regards, tom lane




view thread (11+ messages)  latest in thread

Message-ID: <2735.1543333649@sss.pgh.pa.us>
Permalink:  ../2735.1543333649@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2735.1543333649@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andrew.dunstan@2ndquadrant.com, andres@anarazel.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Update pg_upgrade test for reg* to include regrole and regnamesp
  In-Reply-To: <2735.1543333649@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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