Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, Is there a query I can execute that will give me CREATE TABLE() command used to create a table? Thank you.

Re: Get the table creation DDL

2022-07-10 Thread Michael Nolan
On Sun, Jul 10, 2022 at 10:28 AM Igor Korot wrote: > Hi, > Is there a query I can execute that will give me CREATE TABLE() command > used to create a table? > > Thank you. > Use pg_dump --schema-only -- Mike Nolan

Re: Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, Michael, On Sun, Jul 10, 2022 at 11:13 AM Michael Nolan wrote: > > > > On Sun, Jul 10, 2022 at 10:28 AM Igor Korot wrote: >> >> Hi, >> Is there a query I can execute that will give me CREATE TABLE() command >> used to create a table? So there is no "query" per se? Also how do I pass the tab

Re: Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, On Sun, Jul 10, 2022 at 11:47 AM Igor Korot wrote: > > Hi, Michael, > > On Sun, Jul 10, 2022 at 11:13 AM Michael Nolan wrote: > > > > > > > > On Sun, Jul 10, 2022 at 10:28 AM Igor Korot wrote: > >> > >> Hi, > >> Is there a query I can execute that will give me CREATE TABLE() command > >> us

Re: Get the table creation DDL

2022-07-10 Thread Ray O'Donnell
On 10/07/2022 17:47, Igor Korot wrote: Hi, Michael, On Sun, Jul 10, 2022 at 11:13 AM Michael Nolan wrote: On Sun, Jul 10, 2022 at 10:28 AM Igor Korot wrote: Hi, Is there a query I can execute that will give me CREATE TABLE() command used to create a table? So there is no "query" per se

Re: Get the table creation DDL

2022-07-10 Thread Michael Nolan
I do not know those other tools, but there should be documentation for them, as there is in the man page for how to process just one table using pg_dump. You can pipe the output of pg_dump directly to psql, but I find that's seldom useful. -- Mike Nolan

Re: Get the table creation DDL

2022-07-10 Thread Mladen Gogala
On 7/10/22 13:57, Michael Nolan wrote: I do not know those other tools, but there should be documentation for them, as there is in the man page for how to process just one table using pg_dump.   You can pipe the output of pg_dump directly to psql, but I find that's seldom useful. -- Mike Nolan

Re: Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, On Sun, Jul 10, 2022 at 12:47 PM Ray O'Donnell wrote: > > On 10/07/2022 17:47, Igor Korot wrote: > > Hi, Michael, > > > > On Sun, Jul 10, 2022 at 11:13 AM Michael Nolan wrote: > >> > >> > >> > >> On Sun, Jul 10, 2022 at 10:28 AM Igor Korot wrote: > >>> > >>> Hi, > >>> Is there a query I can

Re: Get the table creation DDL

2022-07-10 Thread Mladen Gogala
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.

Re: Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, On Sun, Jul 10, 2022 at 2:27 PM Mladen Gogala wrote: > > 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 a

Re: Get the table creation DDL

2022-07-10 Thread Mladen Gogala
On 7/10/22 17:00, Igor Korot wrote: I understand. The Problem is that I need to put this inside the C/ODBC interface for my project. I'm sure it is not a problem when people are working out of psql or writing some scripts, but for me it is painful to go and try to recreate it. Now, I'm not sure

Re: Get the table creation DDL

2022-07-10 Thread Mladen Gogala
On 7/10/22 20:02, Mladen Gogala wrote: This "extension" is nothing PL/PGSQL source code This "extension" is nothing _*but*_ PL/PGSQL source code -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com

Re: Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, On Sun, Jul 10, 2022 at 7:02 PM Mladen Gogala wrote: > > On 7/10/22 17:00, Igor Korot wrote: > > I understand. > The Problem is that I need to put this inside the C/ODBC interface for > my project. > > I'm sure it is not a problem when people are working out of psql or > writing some scripts,

Re: Get the table creation DDL

2022-07-10 Thread Rob Sargent
> On Jul 10, 2022, at 6:16 PM, Igor Korot wrote: > > Hi, > >> On Sun, Jul 10, 2022 at 7:02 PM Mladen Gogala >> wrote: >> >> On 7/10/22 17:00, Igor Korot wrote: >> >> I understand. >> The Problem is that I need to put this inside the C/ODBC interface for >> my project. >> >> I'm sure it

Re: Get the table creation DDL

2022-07-10 Thread Mladen Gogala
On 7/10/22 20:15, Igor Korot wrote: I understand. The question here - does this "extension'' is a part of standard PostgreSQL install? And if not - can I copy and paste that code in my program? Thank you. Of course this function is not a part of the standard install. If it was a part of the

Re: Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, On Sun, Jul 10, 2022 at 8:09 PM Rob Sargent wrote: > > > > > On Jul 10, 2022, at 6:16 PM, Igor Korot wrote: > > > > Hi, > > > >> On Sun, Jul 10, 2022 at 7:02 PM Mladen Gogala > >> wrote: > >> > >> On 7/10/22 17:00, Igor Korot wrote: > >> > >> I understand. > >> The Problem is that I need

Re: Get the table creation DDL

2022-07-10 Thread Mladen Gogala
On 7/10/22 21:13, Igor Korot wrote: How should I do that? Thank you. Oh boy! I give up. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com

Re: Get the table creation DDL

2022-07-10 Thread Igor Korot
Hi, On Sun, Jul 10, 2022 at 8:14 PM Mladen Gogala wrote: > > On 7/10/22 21:13, Igor Korot wrote: > > How should I do that? > > Thank you. > > Oh boy! I give up. Does he mean I need to make it as a GitHub module? Can I even do that given that you use GitLab and my project is on GitHub? Thank you

Re: Get the table creation DDL

2022-07-10 Thread Rob Sargent
Do it properly. Make it part of your coding infrastructure so it’s available in the next environment. You’ll thank yourself How should I do that? Thank you. I don't know what build system you are using.  How do get to a running programme?  Are you alone or on a team? The instruction above o