Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6ASv-0001SE-2R for pgsql-gui-dev@arkaria.postgresql.org; Tue, 19 Mar 2019 08:51:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h6ASt-0007qG-GN for pgsql-gui-dev@arkaria.postgresql.org; Tue, 19 Mar 2019 08:51:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6ASt-0007nP-9N for pgsql-gui-dev@lists.postgresql.org; Tue, 19 Mar 2019 08:51:19 +0000 Received: from mail-it1-x12a.google.com ([2607:f8b0:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6ASr-0005kW-LZ for pgsql-gui-dev@lists.postgresql.org; Tue, 19 Mar 2019 08:51:18 +0000 Received: by mail-it1-x12a.google.com with SMTP id w18so24765152itj.4 for ; Tue, 19 Mar 2019 01:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetbrains.com; s=googleapps; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SXqOqRiNPJsMdf0ads4bpVmyh5m/nDh+AhqNJVzwcU8=; b=YdP0S/MC03xH6W8t/qP1k+VL6fCnlB3Ty32jtAyV0LBhRcDmdKN9VU2nf57qQqdSES jL3nQc+YY2oxpCZthpGWwmtbTgKHw5syIULDXTPNai+vDQ7Kv+4w80gvRIcIYtRNZQM9 pQPT+NRj6ceB9HTS4H8lyPpCYl6ssbMRkScqY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SXqOqRiNPJsMdf0ads4bpVmyh5m/nDh+AhqNJVzwcU8=; b=rv9t8jB1BLYhME/dwfbVS2f/JX9Dwmt+qq9xJD05HFY5lkf28b2DR8odjM9bzif0iq EkL29UmHwXMrLMoRfbEoxUUjFCUYe18KgMOgUY+UQD42h7UCKIvUScOZALzBqwPayP96 VPmwe7hxw2NFv10MhdafkfEUlTPM2LOUOi/64DChSi/NlEKsDxfgq1/aahgFQVlVGBbQ N8a6fo+U2zv4kt1UxfeFnLNqC3pTb/123PypOgg8kYtqd9QTk7EHouFlsRUIjwDrQUN4 ETStFxlT3IcbSM/W9pZVSuKBaVxGJTG6O2dx8DErCKQbPX25Cidtj3qhWFK+yMfxD5wf EEVg== X-Gm-Message-State: APjAAAVAGE94oWwdpdspnWf9Ng2BN8AyttIVUXJE4HQrKK9pOfkML8TT RNwLGj+ZFP7MePtFfC8moQhXU62oYtLRzS+mqAKyow== X-Google-Smtp-Source: APXvYqz1+FPVaVSiQPvm+UsHcCTpElIYGsCVNDAXCmU/0HTmyfwtqzAN4UhPbESFM4SRgB+FVPCh9kGsfBQMRSSHA1E= X-Received: by 2002:a24:3911:: with SMTP id l17mr645773ita.45.1552985475050; Tue, 19 Mar 2019 01:51:15 -0700 (PDT) MIME-Version: 1.0 References: <2bc470194b4837c1f733a4e05f569bc6@dalibo.info> In-Reply-To: <2bc470194b4837c1f733a4e05f569bc6@dalibo.info> From: Maxim Sobolevskiy Date: Tue, 19 Mar 2019 11:51:04 +0300 Message-ID: Subject: Re: Export the CREATE TABLE command in pure SQL To: Damien Clochard Cc: pgsql-gui-dev@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000950ff605846e9b95" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000950ff605846e9b95 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable In DataGrip, which is java-application, we first get all attributes of the object from the database, then Java-code generates the whole DDL based on the attributes we have. On Sun, Mar 17, 2019 at 11:49 AM Damien Clochard wrote= : > hey guys, > > The most effective and simplest way to export the creation command of a > table is to use `pg_dump --schema-only` > > However for one my projects, I don't have access to pg_dump and I need > to extract the data with a SQL or pl/pgsql function. I already wrote a > na=C3=AFve implementation that handles primary keys and temporary tables.= But > I realize it's probably incomplete and I will have to maintain it for > every new PostgreSQL major version.... > > How do you guys deal with this ? It seems that a lot of GUI tools are > able to "export the table structure".... Is there an extension somewhere > to do that ? Is it possible to write i in pure SQL ? If yes, there > anybody here interested in joining forces to build a shared export > function ? > > Have nice day ! > > -- > Damien Clochard > > --=20 Max Sobolevskiy Product Marketing Manager of DataGrip JetBrains --000000000000950ff605846e9b95 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In DataGrip, which is java-application, we first get all a= ttributes of the object from the database, then Java-code generates the who= le DDL based on the attributes we have.



--
=
Max Sobolevskiy
Product Marketing Manager of DataGrip
JetBrains
--000000000000950ff605846e9b95--