Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oAca5-0003CV-Iq for pgsql-general@arkaria.postgresql.org; Sun, 10 Jul 2022 19:27:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oAca3-0001W5-Kl for pgsql-general@arkaria.postgresql.org; Sun, 10 Jul 2022 19:26:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oAca3-0001Vp-3t for pgsql-general@lists.postgresql.org; Sun, 10 Jul 2022 19:26:59 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oAcZw-00078E-6C for pgsql-general@lists.postgresql.org; Sun, 10 Jul 2022 19:26:57 +0000 Received: by mail-qt1-x82b.google.com with SMTP id i21so3704034qtw.12 for ; Sun, 10 Jul 2022 12:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=Ptyd6mu3LLs+ObuBESgT5/3kR9lptLm5HWD9zsnHSr4=; b=BKosaUK6AZ/MPoBXlW83EupAr+I9PmtSTkIM3ZO0umOtMMM/tFbP3MbG3OiPzV2KBC IxWKicAIeGLpGGl9mvNZHhUdfqYkgkJ3/ihvL6Dya4EuecRavVzgavWoWc7CqLLXMQKp gELqJw6xl4LkjLk6WpbBJW3fqs/mdSb+Qk82ymHJA3+xt2tNJovMtf5hTYrWDt7LwvtC KWJVh5tfWkB6zNbGRCfxLJQHQvX9PLA6WrGlEVBavBAC/0d7s8TajS4ZaNpfRa+K3JuB SuH45GOZEQin9sueRT6FwBxb/LOPDmj1WmKKo1UrzT+9IfwRR7ZH9wTn1dYeUYl9Mfrl oSBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=Ptyd6mu3LLs+ObuBESgT5/3kR9lptLm5HWD9zsnHSr4=; b=a3LCu1ND7/tgenesz2YsoKpysP/Hy6Qj7ZpQHG3Ds+uomOjWNRGwiuESfAcBS4n9rW 9dWtryFUtVTzYPcgUYSorB2bYtRWDWtsqWfL5MJO1EP30WvGao+U6UVxi0iY6AJBaCIT pmd5aAPKo+5Xcq/YnfCnhQgkDDeTPBqheEreALB5eMGg0XwSmc4K9HabpAqtZpJRF4N7 l3nWVjFPwakYnhu3cBYqA0fiT03d/Z38n8KYzmnLHWH+hGRubhCVtiLh8HK1tidYeAKL BoHUs4rQ9xtFeWJXhDoUL2F7V/yHiaZaAGeKzQ7PTQTzaHrUBrzf2SvPFjCcGvujd2ZS 2AUg== X-Gm-Message-State: AJIora+fHgK4YNWKW33qCVwr6cZJ5KkevKJ4J6Yd3G5yK1eIRDTUzgag IMaenOozRgYDdrKBQYFfzr2UHrPsujfodQ== X-Google-Smtp-Source: AGRyM1uZenBs5vXCczjy/ms1G2gZQQPhsZLSM7RfnwsBiiyy21eLqKKn8sXS6j66Dx1sFMf8OK4Bgg== X-Received: by 2002:a05:622a:64b:b0:31d:47f1:1507 with SMTP id a11-20020a05622a064b00b0031d47f11507mr11352230qtb.688.1657481211024; Sun, 10 Jul 2022 12:26:51 -0700 (PDT) Received: from [192.168.2.100] (pool-72-79-19-93.nwrknj.east.verizon.net. [72.79.19.93]) by smtp.gmail.com with ESMTPSA id t3-20020ac865c3000000b002f39b99f6a4sm3799318qto.62.2022.07.10.12.26.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Jul 2022 12:26:50 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------iaD2mvsYX9o70tQtsPQWkEZh" Message-ID: Date: Sun, 10 Jul 2022 15:26:49 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Get the table creation DDL Content-Language: en-US To: pgsql-general@lists.postgresql.org References: From: Mladen Gogala In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------iaD2mvsYX9o70tQtsPQWkEZh Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/10/22 12:47, Igor Korot wrote: > So there is no "query" per se? > Also how do I pass the table name? > > Thank you. You can create one from the catalog tables. Personally, I would use INFORMATION_SCHEMA to avoid pg_class and pg_attribute. However, there is an extension which does that for you. Somebody else has already done the hard work. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------iaD2mvsYX9o70tQtsPQWkEZh Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 7/10/22 12:47, Igor Korot wrote:
So there is no "query" per se?
Also how do I pass the table name?

Thank you.

You can create one from the catalog tables. Personally, I would use INFORMATION_SCHEMA to avoid pg_class and pg_attribute. However, there is an extension which does that for you. Somebody else has already done the hard work.

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------iaD2mvsYX9o70tQtsPQWkEZh--