Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPcw6-0002J2-6x for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Oct 2019 01:38:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iPcw3-0003BM-QE for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Oct 2019 01:38:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPcw3-0003BE-BA for pgsql-hackers@lists.postgresql.org; Wed, 30 Oct 2019 01:38:07 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iPcvv-00033M-KE for pgsql-hackers@lists.postgresql.org; Wed, 30 Oct 2019 01:38:05 +0000 Received: by mail-qt1-x843.google.com with SMTP id c26so1002247qtj.10 for ; Tue, 29 Oct 2019 18:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=mDt51bZVoezS3SJ9sWTv/C61OWRjcn0MkJk/mizqbBA=; b=T5bQ5ue1WJDaGtRRLO2yQMl+C+kC0m1CSKhs1SlKPXU0ZXtJG7GoGTWQMy+KCrXL4Q pIp3+umzJT7JijVRuNy1M3UVbJw0/yRpbSQo7E1GnTCrm74Fn/tLV3KNacP8rjoaSe2A dEWGaAJs6BN77aRz3MGuWa56fZ1wvW/GSuH1nNQ/JEYgHjfmw3uS2upIs/xMocZm9VQ2 QqWagaeXARuBa1kdMIV1Kt5RCAgCWx5KinanmOFDwb0hrtfD6/ErSx/z5LN/qQTfhoF7 MTQwX8wdLVKIvvAPSzvEBHda9cnoWHZE474em1U6FhYi5tibukt0SAiMEi9FQzZkg0Wu RCZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=mDt51bZVoezS3SJ9sWTv/C61OWRjcn0MkJk/mizqbBA=; b=QEqqE3zXFheTYMYZ3XO/RkhfsqNrzE8QKxJAoJKcloBV1ZhNltqlKP/sBvqUNnIj2G FczNHKlnv16QdBaRNAWhYfZwrU0ezm4puXq9dwUpe9MsVO2aJZLaM0g3btfpLJ+1APYp N/r86uP75eEgfMzseblpou3ZsPWm+/FtmHsNAyT5jg8hFt31Q78lsMHZY8cl/qdR2viA 7jRv5i6J8JWjVX6AtWG8FO7y4uowtju0qFuWLxD79bxxPvqITSUkfoexS+4hCqv0p/el hhsIB2QcoRX469aP9k554qUBoVdzsawKsyFmC77HhCUEA7aQd033kMxZKFKoSQDmY5L4 JRcw== X-Gm-Message-State: APjAAAVjNM60mHoWc+QVlnm2Tp0IXGkVj4pz9+Y9pK9IdpRb5Oqr3TjT CtHFado+7YXOlHTejwuAKSfmRw== X-Google-Smtp-Source: APXvYqxiLeg12ru5RKn8/VPImf7XZGaZkDYiaOkS+zf2dE5q0E7OgyuFzKalBCafO/jZLDpAGDVkxg== X-Received: by 2002:a0c:fbc6:: with SMTP id n6mr20341375qvp.45.1572399478357; Tue, 29 Oct 2019 18:37:58 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([191.125.99.218]) by smtp.gmail.com with ESMTPSA id t5sm500689qkm.77.2019.10.29.18.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 18:37:57 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id A27CA300AA5; Tue, 29 Oct 2019 22:10:39 -0300 (-03) Date: Tue, 29 Oct 2019 22:10:39 -0300 From: Alvaro Herrera To: Tom Lane Cc: Robert Haas , PostgreSQL Hackers Subject: Re: Rearranging ALTER TABLE to avoid multi-operations bugs Message-ID: <20191030011039.GA9097@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <30897.1572373085@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Oct-29, Tom Lane wrote: > The thing I think you are actually worried about is the interaction > with event triggers, which is already a pretty horrid mess in this > code today. I don't really follow the comment here about > "ordering of queued commands". It looks like that comment dates to > Alvaro's commit b488c580a ... can either of you elucidate that? The point of that comment is that if you enqueue the commands as they are returned by pg_event_trigger_ddl_commands() (say by writing them to a table) they must be emitted in an order that allows them to be re-executed in a remote server that duplicates this one, and the final state should be "the same". > Now, if we move things around like that, it will have some effects > on what event triggers see --- certainly the order of operations > at least. But do we feel a need to retain the same sort of > "encapsulation" that is currently happening due to the aforesaid > logic in utility.c? I don't fully understand what that's for. Sadly, the DDL replay logic is not being used for anything at present, so I don't have a good test case to ensure that a proposed change is good in this regard. I've been approached by a couple people interested in finishing the DDL conversion thing, but no takers so far. I know there's people using code based on the src/test/modules/test_ddl_deparse module, but not for replicating a server's state to a different server, as far as I know. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services