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 1w3JTC-0016OP-0o for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 19:55:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3JTA-002OWn-2S for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 19:55:49 +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 1w3JTA-002OWf-1a for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 19:55:48 +0000 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3JT8-000000003qz-0995 for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 19:55:48 +0000 Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-50b35f3e489so3084301cf.0 for ; Thu, 19 Mar 2026 12:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773950145; cv=none; d=google.com; s=arc-20240605; b=XtGWs7NYXcKcc0y8N4UDddgsnwO0ck26jCkIGEOeYp2s0dXAgRK88fG7ycn+Gi5O1/ 8T/KkJaHmDmLJd8MwcaeSs2RuZGOmGg4OzJnH54+rjs0uuK1I+Dc+IznvQ/nqEqK13DI wWbwD5/WpZ+oLs8QDAOtYP8E8aMGBqiSFxY3bJr38mFHn7zwoZaxDn4++Rs/kpQ0XPiy VL3ewmkqJ9b4pViDYKrGCuloDva7fOvEnPqTMrJUsZRNbQA5OqlxPJupKAbbuI8EHLaK 1O4goqDE+5SCYSzY2ay/UgW/gPZemVeNwHT9ydfl1F5klXdCHHH2NT+m3X4dhWJC7v0+ mLVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=59oPivpQ7tEo/3SE18+c/qiA/wefO9gpRN9Uys894cM=; fh=UwB8uq6c8r+N1V6qt+QBbZ8AkxdKGobi0KnBWRuNqbg=; b=OkjxOZSVrmr+1NiGbw0H/E46EgS2/IcEfL2CBVnyeAJg7YhrThhrRm4MN5x8yktEGa NUeur3/fotTx3MRpJZVy7pKDpI7oxWFS+PWcrmBsfBZ8k/jb7iHWEPiysw19/hmyZqno W4/tI/l+eVP2GYCvrygnvVEc2sxzdEU2YSxUw8WkcIJpbuEtUJ77jd5JHC5TG/6RbxbZ MzZd7XoT9HEnlsea51cc6Oz9YLzLdg0gHBAHUq2cQkUoVc1Wr2YEhl0n90f47lzDSer3 x3QABySIaORRNt9O6ywiiGiKpE6JBoW8wpj372EwiY9rkuwNwfze5BEmg72tgQuJzZZh 7LaQ==; 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=1773950145; x=1774554945; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=59oPivpQ7tEo/3SE18+c/qiA/wefO9gpRN9Uys894cM=; b=Ov1+gLwlL2MvZiM80U4oLb41yVifZex/sbtjSvxs4h9XeYA5kJH06YvOax0GEG5bnn QK6+bEfQJGRiFk/K8VJbtCuMAWagc/eDNFnHUZ9BtFHzyM2kFtBdp9CEC6qVKzExEcGS ALzncwof/KZSuICCh+PLYK1b6nLC9nlXJkQ9qj2yTexcQDa82PKOkYKnjLWqw8ZGOcbN cgfMGIttl558I9++INv+0eZGwPnTiT9h+46QeTDe+rbWqTmjXfiB6Zog1dVj5dhMKdRl HURsQ2VMGNRlTeAn8h8e5PmXuHw0J2KwP+DYMgCltAhHtzA5uvrYmzG2Et00q9OPawaU JdpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773950145; x=1774554945; h=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=59oPivpQ7tEo/3SE18+c/qiA/wefO9gpRN9Uys894cM=; b=eIsQhWcTkuvafeEpdUyPSM0UczwhKqJu05hLd98d2fF0YHfM0aS2EUQDLD7WJHmhfl 4FFtDS3weA5r8artTbu1tRyrdL21aMNfvY/x4pYdb2vYJqPlc86rp/8mfETgm0ZPrDwb ck1MonGm1H0cEilKQ/q/3L4jEu2JhmkUwuYx/DGDRktZsYgNp4V+nhxInc9trLBGcxd5 CgYmao5jdQg8Hg5MoXyaj2gOtKfPRo0HroD1i3tyzn4T4dAiPaJudX3mGjQqXszQIekJ oiXi+yXBzRvG9kc+q5vh2KVepSWbWtlKmYBXvY/y0yqVnXvvjRpVWE2RsP8TtE4EmajA 0V+g== X-Gm-Message-State: AOJu0YzeS7a89UD9ge1tKx+0RNnlhglYy7ICOb7iDmXjGdIzFhTpEVlY kqbNXJewVY5rmJ7XudA6B5kqum2OOsPKQodfWWwwKPlEz0rAFO+FUELhARPHzShcsROChYxoIhG 7g7vOTXNOIf3spfkUCE3AlPu2NnYsiOo= X-Gm-Gg: ATEYQzzPTlUW+XeiEg3ccKt5/aWi4qpv0G56XiFeJKLy7WHxFzwgvrbMGYso4QkG1ng 4BsoDbEChmqa3gpesIrrGkSktHwzm+hTgAUSZB6Pdc/a68OH3WLWnYrUsEkIfDUHI3D9PCMSwuA 2s6WFvegqw3UTrbS0XWbjuvBeTC9x63HG8K5s/TzdeDPnHZUjeVOOOTtyw+aB1/vIfCVfMnbQWI TMju9w3O4BSeAlvD3FmNK5PkIec+C8CURKaS9qcSn7jvZM8fQo5JLWhBVdHgVqHovba5J2yk/ss KH7lzIjhQQ== X-Received: by 2002:ac8:5815:0:b0:509:465:1d78 with SMTP id d75a77b69052e-50b24775795mr68639321cf.35.1773950144821; Thu, 19 Mar 2026 12:55:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Mahendra Singh Thalor Date: Fri, 20 Mar 2026 01:25:31 +0530 X-Gm-Features: AaiRm50DEOfyi1JpvNiBlrsXiD9l5lHC4QTou5toSzjsz1xfFN1hLfRIaGNQwuw Message-ID: Subject: Re: pg_get__*_ddl consolidation To: Andrew Dunstan Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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-cb1e56f2e3e9%40dunslane.net > > [2] > https://www.postgresql.org/message-id/flat/CANxoLDc6FHBYJvcgOnZyS+jF0NUo3Lq_83-rttBuJgs9id_UDg@mail.gmail.com > > [3] > https://www.postgresql.org/message-id/flat/4c5f895e-3281-48f8-b943-9228b7da6471@gmail.com > > [4] > https://www.postgresql.org/message-id/flat/CAKWEB6rmnmGKUA87Zmq-s=b3Scsnj02C0kObQjnbL2ajfPWGEw@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. TAB is not working for these functions. I think these functions should be displayed with TAB. I will do some more study and will do some more tests. -- Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com