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.96) (envelope-from ) id 1w3Jyi-0016pl-0X for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 20:28:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3Jyg-002frH-0c for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 20:28:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w3Jyf-002fr5-2o for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 20:28:22 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3Jyd-0000000048L-2764 for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 20:28:22 +0000 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-506bcb23a78so8068101cf.3 for ; Thu, 19 Mar 2026 13:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773952098; cv=none; d=google.com; s=arc-20240605; b=jeIAnsygois/56EABFbMetbl7AXLBQAyU+K/EMi1Jv+TQF49KBLYx+OGMeIQ6771Ze 4DWd7QY07JoNhl+hXidsN1Bu+D89OI5LfMDkQz1tKukUlPnypT6tcVb2A7iyguakm+m6 7h8ldbA/cg1T7CN0Tu3LM4SQBvprg0nb8s5iOfR9hCohyeJJx7YAAmicWd5Q/iHCa7SI 9p6W1dEEjVKr3/INv6fXEaIsU8vmhPKjQ0M9v2Hhg7TdKtAntlspcpzGzQwnXrhKtG5B X3X9SU4XeTXZHIiE6FYd7/6Chzjlq9MFBEqphausug6Z3FuyrhoOlPrY/yi1MUimuTCy n7qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NRu5H0D+bCZs4BhkDam6kor1OTLzLUgM/JPlrK/ZdXE=; fh=UwB8uq6c8r+N1V6qt+QBbZ8AkxdKGobi0KnBWRuNqbg=; b=DwHTfNA0MgChWWxy5BNkYlAKGZfd/2YqjEvC0d/eUsEmd6MO26G2lFB2qN/K7MP/qx axjXuisaZwK/ByMfV0MVRbVgnUqbUqizpe+93RsBWjuhI1Oo/Kxw5Uyo9yn7WUpp+jmP jUqlP+4qiSYQ3f2DYWUj+xteCnmxG01pnnHaRQXWGLDJTctd3d+VxsonV0gWLfzZBB/V T3oPuPi5lnTYt0xsMTgzrrFntrCHwC86mAFb9El0vJKCI7615yVKl782TGdm1MHpuWZd Tz9WPL9FIkvmdKGgFFp39wYqVS2BF+SqDXkNAh5Ycei7YmuR9Hzae6UEFDQBrO7L9Ezp TH0A==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773952098; x=1774556898; 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=NRu5H0D+bCZs4BhkDam6kor1OTLzLUgM/JPlrK/ZdXE=; b=O52DGNIeNFUwriZ+C+m8TvTAJylLIQs3lPgUUzHTIqeGk9udSG+tdgxYrgSyB6gUiF J7m37XO0TQL2+pKyZEevhhYvRY+Kni0JQFhJWFdecApPc641vJwyUh9eBzzSUVXbVPif ZcoLtIp0KjhdGPYl2DZDs5+FDGFKA9pJO+VLYNJMJaKsV74RmTKLTbrDNwKEg/sK8RQ4 SUrY9xQiuHh4qHpRefKhygaFN2M/jy+oMWKD51NUXvOqovXF+auy2He7E30WC8uW08ao o8PazAqdIkgs6Z+tABswVulTmo6ygrOGYiwzb+zVIIyBFlIq6io6wX9Z2VNm0ZdhMcjY dKyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773952098; x=1774556898; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NRu5H0D+bCZs4BhkDam6kor1OTLzLUgM/JPlrK/ZdXE=; b=eJal3n9U/Q5PABS2MTwujbe8Rm0k5WywuBasnD/VJ6SPs6jwksbvjUZ9MtyThqlIgw xF3ytgontvNJss0npWGBaw2Lftxt9asEMTkGjIgGapzqTKk/JZB/eOE4V7CXQXvL84Bi G9Iblo+fTYH3qD+a0+4WdqGpBiLVmAelDywZb6XKDB6IrMc1XA5jnrXoQDPLtoJeYMOT RSJ8TZmxUIqAIOjpNDtrLq32H63kH9rO9f7nB0TBUWRJTMKUNfQyXJZCCAvT/3AJzXMz 70aTKS1fBYtJWIVhU/tA9uzpxVbzV9ft2HPYTiPPs/mMhzLG6R6rUgoUX9FPKq/GCmZP eIiw== X-Gm-Message-State: AOJu0YwzCkUvthqXBCE4Gtn3k1/qq2JWlGTrMX+x+enkHPLHTVnBQLAv yeL3zcnbIsx2GmurTKC11ubZPMn823C89DTfV6fAfvSwzkMapTJAVmw1Fy879E6DFP/ftj6mcSg s8Hwb6NcGm5YKSmIOZKDZNAkBFtmMS14= X-Gm-Gg: ATEYQzzARdn39v13ITew+r9JUiqvQjSWJCZsziqzhZlh/mahmePR+EhcQuGFSNXkaGA +1osz1hOIe+y+BHP32v1jHN3yShn1sOHV5TZrniXZPHl9VKivGFrwaYSx24Xkgd/7WeUan6g22/ n5/hfAYmrU4wId14xTkQ9r1rj6TX9gFYXEPjGRPvL84r9Ie+ZITqyjbR4Avq/yNfhG2MwTMnKQG XXdXxJwz8ImVjz8rWrzfiSpFSml37gElVBpG/vc1dxIAbTnk5B5nV9YCYh1v4/iNmau6Pb3z/bx eX9xAvounw== X-Received: by 2002:a05:622a:6101:b0:509:3f5d:4f9e with SMTP id d75a77b69052e-50b37393763mr9605951cf.4.1773952097681; Thu, 19 Mar 2026 13:28:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Mahendra Singh Thalor Date: Fri, 20 Mar 2026 01:58:06 +0530 X-Gm-Features: AaiRm51T2PsyEez7NBjl9AUTYmxcmiH6fj-9an54GNAuF2kSD_eIhG8jeI68GEo Message-ID: Subject: Re: pg_get__*_ddl consolidation To: Andrew Dunstan Cc: PostgreSQL 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 Fri, 20 Mar 2026 at 01:44, Andrew Dunstan wrote: > > > On 2026-03-19 Th 3:55 PM, Mahendra Singh Thalor wrote: > > On Fri, 20 Mar 2026 at 00:04, Andrew Dunstan wrote: > > Greetings > > Euler Taveira and I have been working on consolidating these patches. > > These patches came out of a suggestion from me some time back [1], and I > used it as the base for some work at an EDB internal program. Perhaps I > was motivated a bit by Mao's dictum "Let a hundred flowers bloom; let a > hundred schools of thought contend." I wanted to see what people would > come up with. Therefore, if this has seemed a bit chaotic, I apologize, > both to the authors and to the list. I won't do things quite this way in > future. > > Rather than adding to the already huge ruleutils.c, we decided to create > a new ddlutils.c file to contain these functions and their associated > infrastructure. There is in fact a fairly clean separation between these > functions and ruleutils. We just need to expose one function in ruleutils= . > > We (Euler and I) decided to concentrate on setting up common > infrastucture and ensuring a common argument and result structure. In > this first round, we are proposing to add functions for getting the DDL > for databases, tablespaces, and roles. We decided to stop there for now. > This sets up a good basis for dealing with more object types in future. > To the authors of the remaining patches - rest assured you have not been > forgotten. > > Patch 1 sets up the functions used by the rest for option parsing. see [2= ] > Patch 2 implements pg_get_role_dll see[3] > Patch 3 implements pg_get_tabespace_ddl see [4] > Patch 4 implements pg_get_database_ddl see [2] > > > cheers > > > andrew > > > [1] > https://www.postgresql.org/message-id/flat/945db7c5-be75-45bf-b55b-cb1e56= f2e3e9%40dunslane.net > > [2] > https://www.postgresql.org/message-id/flat/CANxoLDc6FHBYJvcgOnZyS+jF0NUo3= Lq_83-rttBuJgs9id_UDg@mail.gmail.com > > [3] > https://www.postgresql.org/message-id/flat/4c5f895e-3281-48f8-b943-9228b7= da6471@gmail.com > > [4] > https://www.postgresql.org/message-id/flat/CAKWEB6rmnmGKUA87Zmq-s=3Db3Scs= nj02C0kObQjnbL2ajfPWGEw@mail.gmail.com > > > -- > Andrew Dunstan > EDB: https://www.enterprisedb.com > > Hi all, > I was reading these patches and found that any user can get the > definition of database/roles by pg_get__*_ddl. I think these functions > should be restricted only to super users as these are cluster level > objects. > > > You could construct these functions using plpgsql. The information isn't = hidden from non-superusers. So what exactly would making these functions su= peruser-only achieve? Now it's true that the user might not be able to exec= ute the DDL. But that's not the point. Thanks Andrew for the clarification. > > > cheers > > > andrew > > -- > Andrew Dunstan > EDB: https://www.enterprisedb.com Sorry, my question might be stupid. Can we use these functions directly into our dump utilities so that common code can be removed and if there is any syntax change for a particular object, then no need to change into different-2 places, rather we just need to change it into ddlutils.c file only. --=20 Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com