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 1wXmWO-003TJq-3D for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 21:01:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXmWN-00GvdQ-2l for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 21:01:03 +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.96) (envelope-from ) id 1wXmWN-00GvdI-1g for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2026 21:01:03 +0000 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXmWL-00000002EmJ-1a8c for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2026 21:01:02 +0000 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-7f015f87fddso4341547b3.0 for ; Thu, 11 Jun 2026 14:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781211661; cv=none; d=google.com; s=arc-20240605; b=GQ+kdXn+w7XlParoB5qR9LQ1QFXARVzjFmgClurHQHRCWFkyaqsTv+1IIJBPustldA DMBgN0RDr3/8+7M+uOxd3Raz+fqgBG65+uYGwxYZ57yWlKsjHi3fo0tF9dtLew7QMk2K rMEiHWozHf1FpqyoLl/ujQ+5pq3upjPVzc5RWgwCbVvC0JDLlxsl+BpGG9J2BIH4VSoP 1/5sEzPqvJ7g3vuiXIzToOPbcpP6BIc54ahoyhTp9urDqx4B0vQwfv4Rn13b6InKQT2n aFoWRG/glagqFerYV3+dcqJf/U5wyWgPMec2NXtfF3iLZz8zvYlP+QpOscmisL7bYnL7 SVNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :dkim-signature; bh=QTZD+zlvxMv82HeVxxcyGbxi5irc8rAMGM3EPZvZfuM=; fh=nwNxTtLLPTU0ewfLM7SSbrjMajMl+wwnFkCY/fi90vE=; b=G+OKLG1RCUwesb8cvFbTF0S7TdXpjfwoK/Mm7TmiWU4GQDeXF9lhMU+qVeWUdLT4kz RXrHXfONLocdeJEnJ8C4XoAuwkvrb/OkgHJpGzwk/mjEjm8M26U8s1h5b0WaRX6hWcZ2 2tkkIz27E2OQU4UpZI+1Bck0rTOGqaG0vmD/jT14Pxu+29dhPE+vi7q6A4999SLYmjCJ BH3jjEwzLFYLTLUxQ4RlQ+ulUI9+rQ9wmmB7hCi/uWxkJQ9rwgLqIXkvGFIyi/70RLl9 MevzxGd9Ysd57xLfVPwXzdC0X15F9zKwGvu/WdqMj4xu03XJEbHAvbTBVkSbsFs03aYI NUMQ==; 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=percona.com; s=google; t=1781211661; x=1781816461; darn=lists.postgresql.org; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date:message-id:reply-to; bh=QTZD+zlvxMv82HeVxxcyGbxi5irc8rAMGM3EPZvZfuM=; b=LNaqC2+Yw/DwxvLxdlM/uARtpROb9ZYE2KNxduhg95Y2BNlF8VERDy0orinJv9t35e LfOqI2NgeG7NpvWm/IL/lzT520b60UqwinW0G6dZwgVltqVV8eYeQZPzEnK/eio1cXCJ fjLTFgVQe6MlSrxATYVyldeycD6tmAjoZIon6+UtaqSc+CTHbxAlmy/7w3ApcEb65qFE ets3I+W8fTXTdHnmNKA9XiK/xXglpgynH8MxXHQqNJtG8GHGxZUxkD0ZwzhvMhdWDe+C T/lL/wP6HwJ7pr3qCZo+hb68197iL8tDxL7mX9JBvUbzj1f3EFaOm/QU8vQ/DC/pFGFF nj6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781211661; x=1781816461; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QTZD+zlvxMv82HeVxxcyGbxi5irc8rAMGM3EPZvZfuM=; b=eXVIbrE6/vmwIE2Qm49z3Pw729rspdYlnGA2lA5P9NykR1g693abZsX4P4+TAo32rZ feVsDzKrOJHpnuae+rPAsUu8DoWXB11QKQuNQ05wlx76RHhUSdb9wfplJ2x9Zaira/YO hP66423PurLN3euj74+WrDAld3MR8eeqgfS14za/Lqg7dx/b+Arax3yecfEIn6EhE/WL +b453m4jIjUiXw/+5UAU4Aumvw4Q6zJK1eLKYG/R7cmrJXhN8fv9tjAfrPMwmMBlyQqr tmyr2MUd/PnOdwZYTnaEGn3IZjjbzJS8RInamTNT0XF1C3yGXYqACHBKQFZp3glQet6Q Pj3w== X-Gm-Message-State: AOJu0YwGRcPVPC62SYVhB/LvjHfxrZQAXfgI0l3I6c/uW6ki8S1Fjeg8 2vZ9gyvlaQlb5by128oAI0QdM93ETdYcv6XhZ1aSwRJKcsK5V9SJQn2Q+jZdNGqtyomJ1hpsANS 05prj9XwkAZ3sdch+PVZY3TvTCD5UKwSqYw9RWaKKYUUWfS7FZo89uiiY9OtNtaWGHnSnVvaRIn pr4Iv21ASWK9+d2cqirtWLop9+c1IxxNfF2h7iwMOJyGwNwqjM2QHQXyyIoZCBfZIwaWwgmKyV4 ZYIA0DJJbBHbINbPPYERASLjVdNmI9Z26C0tkBAGC3286fiBYIKQMTxga9nKGvGFH7OMnnuCmra 9w== X-Gm-Gg: Acq92OE11dGUUv2lQoBTcKgCgDwwrHuT1/9EPLvcPxNRfAnIXbSI6srIJo5XJPpdujR y9Tmw72w6/EcaezXWtKyqrdP8xGx4AP4mYJXqVhQEgZ2YwR7KpHsVtHLTMsjqfQn5v8OO0I1wYG hW963r3C76PaoYv3bboXU2s+ZrU6RQrMcU84CraJHoTYSL5xJpNhUNtFagvB3PSKlO8YQoI67LG SYuZcltH8hddsP8sDFpGS+vGi4V0mkrWwghxuYquzxhtGWugr8k69KIHqfSa9S8ohjWoUIWBB5j JSQlR6WMFPPzhcMY9rmtyD/mz5pvqk7vJuWRFwHFNbvAj2weGNE6mf+CV/GZRfHCQaVq X-Received: by 2002:a05:690c:62c2:b0:7b6:783f:2122 with SMTP id 00721157ae682-7f79cbe048bmr2770767b3.9.1781211660195; Thu, 11 Jun 2026 14:01:00 -0700 (PDT) Received: from 298783833264 named unknown by gmailapi.google.com with HTTPREST; Thu, 11 Jun 2026 14:00:59 -0700 Received: from 298783833264 named unknown by gmailapi.google.com with HTTPREST; Thu, 11 Jun 2026 14:00:59 -0700 From: Zsolt Parragi In-Reply-To: References: MIME-Version: 1.0 Date: Thu, 11 Jun 2026 14:00:59 -0700 X-Gm-Features: AVVi8Cd3vsb4KIWa39-Mz2GVQ20Wcwgw3fxSvD9SW6_ao3vT0Zk--4klQ4dr9PY Message-ID: Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements To: pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: percona,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The new version seem to work correctly to me, I didn't find any further issues. Now the main blockers seem to be the remaining TODOs related to includes_triggers/includes_policies. I only have some minor comments about code structuring: + * get_inheritance_parents + * Return a List of parent OIDs for relid, ordered by inhseqno. + * + * find_inheritance_children() walks the opposite direction (parent->children), Shouldn't this follow the same naming and parameter pattern and live at the same place in pg_inherits? +static char * +lookup_qualified_relname(Oid relid) +... +static char * +lookup_relname_for_emit(Oid relid, bool schema_qualified, Oid base_namespace) Is lookup_qualified_relname needed? It is only called within lookup_relname_for_emit, and it results in a double syscache lookup, which could be avoided if these were a single function. + /* COMPRESSION clause, only if explicitly set on the column. */ + if (CompressionMethodIsValid(att->attcompression)) + { + const char *cm = NULL; + + switch (att->attcompression) + { + case TOAST_PGLZ_COMPRESSION: + cm = "pglz"; + break; + case TOAST_LZ4_COMPRESSION: + cm = "lz4"; + break; + } + if (cm) + appendStringInfo(buf, " COMPRESSION %s", cm); + } Isn't this basically GetCompressionMethodName(att->attcompression)? + /* STORAGE clause, only if it differs from the type's default. */ + if (att->attstorage != get_typstorage(att->atttypid)) + { + const char *storage = NULL; + + switch (att->attstorage) + { + case TYPSTORAGE_PLAIN: +... And this seems like storage_name(att->attstorage) from tablecmds.c, the only issue is that that's currently static