Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2Svc-0010GM-2P for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Apr 2025 10:45:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u2Sva-00215A-EU for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Apr 2025 10:45:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2Sva-002152-4i for pgsql-hackers@lists.postgresql.org; Wed, 09 Apr 2025 10:45:06 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u2SvY-003rBS-2E for pgsql-hackers@lists.postgresql.org; Wed, 09 Apr 2025 10:45:05 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-2260c91576aso55124615ad.3 for ; Wed, 09 Apr 2025 03:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744195504; x=1744800304; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ih62IZlkBNtzsPFZMmp5XuR+Pet1w2UWtmjmUXy/kDw=; b=CsSioVRH+tDIl4r9utF0YCjdi83p1hDBNnqOK8MybdUf+Ptw0TW4J0k+bQw1L+yBwL mpWaD7nbxSYWdUrrX0v0aZPLQHl0Bm4gx2ZYB3b66id/ScBJ0Q2pca9fryRY7OQF5qfx kt5B4j0Z88mstk645HkVNOUbfa16WdiYcrCZSXc2i3XUc/gnSOc4nELzl4vFqhTYXqXg 3AR1z3uWOxxnBtThp9Su6819ZGIrBkJuPc34iDpisTYS+WCdP2rXFqUzDNcQA+k3+0rM F9icumoQ4PSPHKIMs+ZKBUfJfbzdFDy4V05Qo9cUUcl4YWp96U1FlnwazhD3N841kglb GQ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744195504; x=1744800304; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ih62IZlkBNtzsPFZMmp5XuR+Pet1w2UWtmjmUXy/kDw=; b=R+V7601djZi3xXgQSwcMxYia5FjyDqxGqy4IQjEk9u9f9zx0Styr9cOf2dKnQ6S3qN vdt3mdeNZh+ntduc3/xyItJHxuz58S3xXXNU2baBGp1LfU4RdCocbzAiy+S+uTkyjq3Y dJ3uY+aGmj28XeiY+/w3ZtHz9mUPEJZBFr7rabZQd0wHtE4dvkw+EHbtYyNCTUlBBOUl D0JVekQeqIocdPVRXmB7ok+jaErQiaYtvtwXzW85lOSlytlQSkYeN0wTf6jfV+q09DOK ap7AhY90MfV4NeijaIFZUU1SjrZ6sgdiCHtw3x+Hi3dUq2OtpBZdSQfH2NaFQexeP3ld q1pg== X-Gm-Message-State: AOJu0YyGUt3p9wzOq01+OU+VU0JjQG3d69J/D5YG68Oxlg+Th+t4dzsc c5M3XVUkw9E2fzbzftO6oCg0g6WWmF2jKHe5w9LpSeZEdKPsKsJrHMNzg5p2u6RdYg0hNhD6Pev r8u1qOi0wgt5D+KKF4pwbrSPRKIc= X-Gm-Gg: ASbGnctuuKz+FOHpx+tCqCG71hHn/+Q0OWBXb6tVKS+3dE87p1pz/jMr4cYoRsrwzHE 4pTismjfOufK2Ui+SYBa1WDnARcHzxpJVkbf08HaXe5FucUhmxLKQJ0utbP87GG1xJI7QCPkcRv s6c6hX9JN67u4az522TxwWp6hL X-Google-Smtp-Source: AGHT+IGLNdBkASuwHMR8tDGulXtaHkOwH1YwvBLqDZcfKl/kPCUBZGidCe7L+NeyAlSO4vRo6OGApdP+6rIE+ZFlaok= X-Received: by 2002:a17:902:ebcb:b0:224:912:153 with SMTP id d9443c01a7336-22ac3f2ea53mr32513965ad.5.1744195503545; Wed, 09 Apr 2025 03:45:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Wed, 9 Apr 2025 16:14:51 +0530 X-Gm-Features: ATxdqUHwMbvAy9frmBlX5dXdyr-JyG0iJfePJMXwSKWf7Jiv9otabp_3ISZ1mDQ Message-ID: Subject: Re: Feature Recommendations for Logical Subscriptions To: YeXiu <1518981153@qq.com> Cc: pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 8, 2025 at 2:48=E2=80=AFPM YeXiu <1518981153@qq.com> wrote: > > Business Scenario: > The BI department requires real-time data from the operational database. = In our current approach (on platform 14), we create a separate database wit= hin our department's real-time backup instance, set up a logical replicatio= n account, replicate required tables to this isolated database via logical = replication, and then create a dedicated account with column-level permissi= ons on specific tables for the BI department. > > Recommendations: > > 1=E3=80=81Column Filtering Functionality=E2=80=8C: During implementation,= some tables may contain sensitive data or long fields (e.g., text columns)= , while other fields in these tables still need to be replicated to another= database or instance. Manually specifying individual columns becomes cumbe= rsome, especially for tables with many fields, and complicates future field= additions. We recommend adding a =E2=80=8Ccolumn filtering feature=E2=80= =8C to logical replication to streamline this process. > It would have been better if you could provide some examples. Let me try to describe by example. We have a feature where users can specify columns they want to replicate. For example: Create a publication that publishes all changes for table users, but replicates only columns user_id and firstname: CREATE PUBLICATION users_filtered FOR TABLE users (user_id, firstname); As per my understanding, you are expecting a feature where we can specify columns that won't be replicated. For example say a table t1 has columns c1, c2, c3, ..., c10. Now, the user would like to replicate all columns except c9 and c10, so he should be allowed to do so by something like CREATE PUBLICATION users_filtered FOR TABLE t1 Except (c9, c10). Is that correct or you have something else in mind? > > 2=E3=80=81Logical Replication Account Permissions=E2=80=8C: > Logical replication permissions should be decoupled from general database= access permissions. > Proposed workflow: > Create a dedicated account with =E2=80=8Clogical replication privileges o= nly=E2=80=8C. > Create a logical replication slot and grant this account access =E2=80=8C= only to the authorized replication slot=E2=80=8C. > This account would have no direct access to the database itself but could= subscribe to and consume data from the permitted replication slot. > This approach allows securely providing the account to the BI department.= They can subscribe to the replication slot and perform downstream processi= ng independently, without risking exposure of unauthorized data. > We need to access catalog tables in the database while decoding changes, so won't some interaction with database privileges still be required? BTW, are you planning to work on a patch on these proposals or you expect someone else in the community to work on these proposals? --=20 With Regards, Amit Kapila.