Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nM5nj-00021u-Fn for pgsql-general@arkaria.postgresql.org; Mon, 21 Feb 2022 10:20:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nM5ni-0003gp-Be for pgsql-general@arkaria.postgresql.org; Mon, 21 Feb 2022 10:20:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nM5ni-0003gg-1K for pgsql-general@lists.postgresql.org; Mon, 21 Feb 2022 10:20:14 +0000 Received: from brisi.sourcepole.ch ([5.9.57.43]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nM5nf-0002Qk-Co for pgsql-general@lists.postgresql.org; Mon, 21 Feb 2022 10:20:13 +0000 Received: from [213.55.226.5] (helo=[192.168.43.81]) by vilan-mail with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nM5nc-0001U2-TB for pgsql-general@lists.postgresql.org; Mon, 21 Feb 2022 11:20:08 +0100 Message-ID: Date: Mon, 21 Feb 2022 11:20:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: Detecting schema changes via WAL logs Content-Language: en-GB To: pgsql-general@lists.postgresql.org References: From: Tomas Pospisek In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19.02.22 17:42, Cal Mitchell wrote: > Hello everyone, > > I’m building an open-source data integration tool (SQLpipe) and am now > trying to incorporate CDC into the product. > > Is it possible to detect when schema changes happen via the WAL? The WAL > doesn’t have to tell me /what/ was changed, it just needs to tell me > /when/ something changed. > > For example, anytime I run create table or some other DDL command, there > is a begin and commit message in the log, with nothing in between. If > there aren’t any other operations that create such “empty” logs, it > seems possible to just re-scan the tables that are being synced for > schema changes whenever one of these logs is encountered. I remember having seen a similar question recently here - that is detecting schema changes. Also I think having seen WAL to SQL scripts somewhere. I might be wrong on both accounts, but maybe you want to review the last few months of list archives if you haven't done so already and maybe check postgres' Debian package repository if there aren't WAL to SQL scripts somewhere. As I said, this is what my fuzzy in-brain SQL returns so please don't SIGKILL me if my query was too fuzzy indeen. *t