Обсуждение: Accessing SQL that has been executed behind the interface

Поиск
Список
Период
Сортировка

Accessing SQL that has been executed behind the interface

От
Wizz
Дата:
How can I access the SQL that executes when I alter my tables with the
pgAdmin interface.
For instance, if I add a column, without a doubt, there was a "ALTER TABLE
tablename ADD COLUMN column name int;" executed in the background. How do I
get to it?
I need to make a bunch of changes to a database and then have those changes
in the form of SQL so I can pass it on to a colleague, who will execute it
on an identical database.
Thank you!



--
View this message in context:
http://postgresql.nabble.com/Accessing-SQL-that-has-been-executed-behind-the-interface-tp5875650.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.



Re: Accessing SQL that has been executed behind the interface

От
Dave Page
Дата:
Hi

On Tue, Dec 1, 2015 at 12:41 PM, Wizz <mastuh8@gmail.com> wrote:
> How can I access the SQL that executes when I alter my tables with the
> pgAdmin interface.
> For instance, if I add a column, without a doubt, there was a "ALTER TABLE
> tablename ADD COLUMN column name int;" executed in the background. How do I
> get to it?
> I need to make a bunch of changes to a database and then have those changes
> in the form of SQL so I can pass it on to a colleague, who will execute it
> on an identical database.
> Thank you!

You can either:

- Turn up the log level to include SQL, and extract the statements
from the log (though that can be a pain as there's a lot of additional
stuff there), or;

- Click on the SQL tab on each dialogue you make changes in, before
you hit OK. That'll show you the SQL that will be executed by the
changes you've made in the dialogue.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: Accessing SQL that has been executed behind the interface

От
Wizz
Дата:
That's exactly what I was looking for. I had no idea there was an SQL tab.
Perfect, thank you!



--
View this message in context:
http://postgresql.nabble.com/Accessing-SQL-that-has-been-executed-behind-the-interface-tp5875650p5875656.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.



Re: Accessing SQL that has been executed behind the interface

От
Melvin Davidson
Дата:
>>How can I access the SQL that executes when I
>>alter my tables...

There are two ways, the first is the change to uncomment and change the value of log_statement in
postgresql.conf to ddl
IE:
log_statement = 'ddl'

Then you must do a reload of the postgresql.conf.
ddl statements will then be captured to the log.

The other way is to make the changes to the table in properties.
A. right click on the table
B. left click on Properties...
C. Add column, constraints, etc as needed.
D. Click on the SQL tab _BEFORE_ clicking the OK button,
 
Melvin Davidson
    Cell 720-320-0155

I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

www.youtube.com/unusedhero

Folk Alley - All Folk - 24 Hours a day
www.folkalley.com



From: Wizz <mastuh8@gmail.com>
To: pgadmin-support@postgresql.org
Sent: Tuesday, December 1, 2015 7:41 AM
Subject: [pgadmin-support] Accessing SQL that has been executed behind the interface

How can I access the SQL that executes when I alter my tables with the
pgAdmin interface.
For instance, if I add a column, without a doubt, there was a "ALTER TABLE
tablename ADD COLUMN column name int;" executed in the background. How do I
get to it?
I need to make a bunch of changes to a database and then have those changes
in the form of SQL so I can pass it on to a colleague, who will execute it
on an identical database.
Thank you!



--
View this message in context: http://postgresql.nabble.com/Accessing-SQL-that-has-been-executed-behind-the-interface-tp5875650.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.


--
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support