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 1wfKOl-005Oc1-2x for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Jul 2026 16:36: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 1wfKOk-002Jrx-1k for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Jul 2026 16:36: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 1wfKOk-002Jrp-0F for pgsql-hackers@lists.postgresql.org; Thu, 02 Jul 2026 16:36:22 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wfKOh-00000001Nw3-29lA for pgsql-hackers@lists.postgresql.org; Thu, 02 Jul 2026 16:36:21 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5aebf162770so670650e87.1 for ; Thu, 02 Jul 2026 09:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783010178; cv=none; d=google.com; s=arc-20260327; b=ElLV5t6BjwtEoRNnAfCISxzgNk1MUQc6SwHeanKgg7GXruaYcFGxcrt+RXWXXhs0Kn u2HLDAR2X//iyirbqK5WS84P3csv9OrthzOoxJke6ZKo3yjdgU21pj163dRIO9TP5x30 6Ipt4o0HwVx6meuIcocXUG2D3V2vqQomfRlfHER4PX82SuXdFxDY0gKEprrJwFB0+vV7 sjmJIa3XXMi2dIcprlKA+WOT8O8C9CcFdp96sZv76Xa6aTjz8rj9jM0YxtdT6XZKVrgd 4xgJjMWlZUC29jXrJw7BayhhwFqMQ8Xg/CirgfozheT6x/4N4RiqweWXW/vItQC6j+FH ETBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=Qu757Q4KkftjsFVm+Zx0f1og5O3DK05jOBcA7YXecMQ=; fh=qKcOIo2vezriev9KUbd8yco1YRdfWsitHpCBxgz3LL0=; b=agBWZ9VhLhOiBc9H/38Jbfk7mcwRpyQmUxZAV8xQRLSQRprP+1idZqyCiuhQy2HjPp WtDQre8jcp7+nwtuckl1w1fbaFYuqK7dahlgC1vp2QBuF6i+O6sXaRaVBFEjHEC4AVRb CPJQ+j1pOZ+ZwDe75owj4JAswAN3GHpf1VHMfHxPVGIFotFrEv7N3y1AcXhznU/6R3qx doaHlYXw1pSV7v0QGls6Rl7b44LKqEnJQaeIlPXTox/dXk+JJleQrqAdzNEOYsSp9glp HBruC4iOWHjNos6lb8g27Aj2rIhRlj5YlR/aNAaNt8FOLSMFi6pYnAlbDJZyKplMSieh FA7A==; 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=f10-com-br.20251104.gappssmtp.com; s=20251104; t=1783010178; x=1783614978; 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=Qu757Q4KkftjsFVm+Zx0f1og5O3DK05jOBcA7YXecMQ=; b=FUy0Q3CqIRotXYItugbmSN7u39kPpclmTrw+eCk1S7fCVtM5gva8noiAOfWamIuzbg BRWyjt1Eco/SV5+4v7XnSz8wa4nG7g6NXuo8jgJFNJekHzzWILbi4Bmc82fwrQIY9EVj ZuWhFx+wGksizf/6vGeSRdpt2OYsb1OLK8fgfxSHD09gHBluW8la7WDePTt++YUr3msf cICWkkCgOhrCHPx3QNi9Cv1dyRiJppjoouA71XuOJD+M4ppV8ICemBn3euqlZQBS/EdR GiRnCBZ0Mdc1oXxqe3q0kSuXY5eSgkAO8bzD5nRzhLo4V434uXeShDOk//PDxArmDBq2 hESA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783010178; x=1783614978; 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=Qu757Q4KkftjsFVm+Zx0f1og5O3DK05jOBcA7YXecMQ=; b=ZQrT9VT5Dc71Q9dQqGSP8xzq37DdDyFdRxlIqO6AY/qQXb2ffPucnD+MZ5WWSBOK0Z UDqvXoISTUSGkKZ9cYgCykRcpPtFC7ykt7WZ97HgSBLvJ13TkElvOgiRqQHXPxI9SNOb NvBWrBeeTcJfGgtlRI7pkphFnZrnFquj27ZhhizvDJPyozH1C7oR9JZ8WsJJHCu4nKIV axODvi9YR05CkwwD70qu+KbSjFBsYy1fFrAJeinV9KPIxmPe6Uor3DfVg7CsfRHHnddF ovwoEJYPydXRzM8ZtUiOC0605oVSad7lEMmcbDxWqXSqCrXN7PAwaKBbD+kDTu6quQci J+Sg== X-Forwarded-Encrypted: i=1; AHgh+RrdFIm5XbvXVfBbHqT2d5DegWwRcMRWXA5HjLPIytjBnjEzEZpraio2tzcwPFw6F9tJz1gFfYybJetxmSWQ@lists.postgresql.org X-Gm-Message-State: AOJu0YxWIRLN0osiQPA2pZ7AwTWcVdn3dDGZli0g+xiYOaLAOiF9ULCs 2bChZJ1owYSCpoZFTPc+K8KhMr5kgTiYStLweE/qvPTPh29Z4ZhRqk/7rRkzUNJFRlPzi2GNoci bSggVzmeiXUuy8rR8FgKoRqVbZpbnV0J+vmzaxFV8 X-Gm-Gg: AfdE7ckA1wIQKCLykzwBOLvG8TTcavgwIL48oobfJ86+EHBd2KB2kCP9ssdJCELSgYZ 6tF/pGXYd9Rs35Dq2MOoch93OMIihO552LLBZIqu8Xer6OlkTudlXehq4iMay1NQfiKO89M0ua3 3xM/i7fc1N3K/6Z2mRqn4y2atTGPABMw26VAzKgW+Kp7cnsdK/RiU+TjlJB4msKvcNt9EdEbNSj frYdqCF1l9NuQV42nvwRbmxYDFKcSyPJwRH29Hn6XYuyRONjZgdJ1j9Xw8mAzeCVI22ZFVsGQ== X-Received: by 2002:a05:6512:1043:b0:5ae:b62b:68b2 with SMTP id 2adb3069b0e04-5aecf4a5368mr149353e87.2.1783010177582; Thu, 02 Jul 2026 09:36:17 -0700 (PDT) MIME-Version: 1.0 References: <983C7B03-D9C3-4F15-8913-7616EC5E6414@gmail.com> <20260623.162104.775158751399277188.horikyota.ntt@gmail.com> In-Reply-To: From: Marcos Pegoraro Date: Thu, 2 Jul 2026 13:35:41 -0300 X-Gm-Features: AVVi8CciNWLmWCdD6tW-Ap-A0IgjejiPz6rJQkG4R-MJ2C2nQGfHxR1-bqn2jew Message-ID: Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements To: Akshay Joshi Cc: Zsolt Parragi , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000004414350655a36899" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004414350655a36899 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Em qui., 2 de jul. de 2026 =C3=A0s 04:49, Akshay Joshi < akshay.joshi@enterprisedb.com> escreveu: > *owner* is the one case where it could work, but to make it consistent > with how owner behaves in pg_get_tablespace_ddl and pg_get_database_ddl, = we > should not add it. > > *tablespace* doesn't map to a kind at all. It controls the inline > TABLESPACE clause within the CREATE TABLE statement body it's a sub-claus= e, > not a separate statement. If we added tablespace as a kind, except_kinds = =3D> > '{table,tablespace}' would be wrong (if you're skipping the table > statement, there's no inline clause to suppress), and except_kinds =3D> > '{tablespace}' would imply skipping a standalone statement that doesn't > exist. > > *pretty* and *schema_qualified* are rendering/formatting options, not > statement filters. They affect how every statement is rendered =E2=80=94 > indentation, name qualification =E2=80=94 not which statements are emitte= d. Putting > them in except_kinds conflates two orthogonal axes: filtering (what to > emit) and formatting (how to emit it). > >> Well, I thought you could continue with the same variable structure, just assigning them beforehand if those values were used in the kind list. So, TableDdlContext continues the same, you just add TABLE_DDL_KIND_NO_OWNER and others to TableDdlKind And before anything you see if TableDdlKind->TABLE_DDL_KIND_NO_OWNER is set then TableDdlContext->no_owner receives that value, just that. regards Marcos --0000000000004414350655a36899 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Em qui., 2 de jul. de 2026 =C3=A0s 04:49, Akshay Joshi <akshay.joshi@enterprisedb.com= > escreveu:
<= div dir=3D"ltr">owner is the one case where it could work, = but to make it consistent with how owner behaves in pg_get_tablespace_ddl a= nd pg_get_database_ddl, we should not add it.

tablespace doesn'= t map to a kind at all. It controls the inline TABLESPACE clause within the= CREATE TABLE statement body it's a sub-clause, not a separate statemen= t. If we added tablespace as a kind, except_kinds =3D> '{table,table= space}' would be wrong (if you're skipping the table statement, the= re's no inline clause to suppress), and except_kinds =3D> '{tabl= espace}' would imply skipping a standalone statement that doesn't e= xist.

= pretty and schema_qualified are rendering/formatting options,= not statement filters. They affect how every statement is rendered =E2=80= =94 indentation, name qualification =E2=80=94 not which statements are emit= ted. Putting them in except_kinds conflates two orthogonal axes: filtering = (what to emit) and formatting (how to emit it).
=

Well, I thought you could continue with the same variable str= ucture, just assigning them beforehand if those values were used in the kin= d list.
So, TableDdlContext continues the same, you = just add TABLE_DDL_KIND_NO_OWNER and others to TableDdlKind

And before anything you see if=C2=A0TableDdlKind->TABLE_DDL_KIND_NO_OWNER is set then= =C2=A0TableDdlContext-&= gt;no_owner receives that value, just that.
<= span style=3D"background-color:transparent">
regards
Marcos
--0000000000004414350655a36899--