Thread: Accessing SQL that has been executed behind the interface

Accessing SQL that has been executed behind the interface

From
Wizz
Date:
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

From
Dave Page
Date:
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

From
Wizz
Date:
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

From
Melvin Davidson
Date:
<div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace,
sans-serif;font-size:24px"><divdir="ltr" id="yui_3_16_0_1_1448975735269_9563">>>How can I access the SQL that
executeswhen I <br /></div><div dir="ltr" id="yui_3_16_0_1_1448975735269_9601">>>alter my tables...</div><div
dir="ltr"id="yui_3_16_0_1_1448975735269_9881"><br /></div><div dir="ltr" id="yui_3_16_0_1_1448975735269_9564">There are
twoways, the first is the change to uncomment and change the value of <span class=""
id="yui_3_16_0_1_1448975735269_9586">log_statementin</span></div><div dir="ltr"
id="yui_3_16_0_1_1448975735269_9880"><spanclass="" id="yui_3_16_0_1_1448975735269_9586">postgresql.conf to
ddl</span></div><divdir="ltr" id="yui_3_16_0_1_1448975735269_9879"><span class=""
id="yui_3_16_0_1_1448975735269_9586">IE:<br/></span></div><div dir="ltr" id="yui_3_16_0_1_1448975735269_9538"><span
id="yui_3_16_0_1_1448975735269_9586">log_statement= 'ddl'</span></div><div dir="ltr"
id="yui_3_16_0_1_1448975735269_9721"><br/><span id="yui_3_16_0_1_1448975735269_9586"></span></div><div dir="ltr"
id="yui_3_16_0_1_1448975735269_9720"><spanid="yui_3_16_0_1_1448975735269_9586">Then you must do a reload of the
postgresql.conf.</span></div><divdir="ltr" id="yui_3_16_0_1_1448975735269_9883"><span
id="yui_3_16_0_1_1448975735269_9586">ddlstatements will then be captured to the log.<br /></span></div><div dir="ltr"
id="yui_3_16_0_1_1448975735269_9709"><br/><span id="yui_3_16_0_1_1448975735269_9586"></span></div><div dir="ltr"
id="yui_3_16_0_1_1448975735269_9708"><spanid="yui_3_16_0_1_1448975735269_9586">The other way is to make the changes to
thetable in properties.</span></div><div dir="ltr" id="yui_3_16_0_1_1448975735269_9747"><span
id="yui_3_16_0_1_1448975735269_9586">A.right click on the table</span></div><div dir="ltr"
id="yui_3_16_0_1_1448975735269_9758"><spanid="yui_3_16_0_1_1448975735269_9586">B. left click on
Properties...</span></div><divdir="ltr" id="yui_3_16_0_1_1448975735269_9819"><span
id="yui_3_16_0_1_1448975735269_9586">C.Add column, constraints, etc as needed.</span></div><div dir="ltr"
id="yui_3_16_0_1_1448975735269_9864"><spanid="yui_3_16_0_1_1448975735269_9586">D. Click on the SQL tab _BEFORE_
clickingthe OK button,<br /></span></div> <div class="signature" id="yui_3_16_0_1_1448975735269_9498"><div
id="RTEContent"><fontsize="4"><span style="font-weight:bold;font-family:arial;color:rgb(0, 0, 255);">Melvin Davidson
</span></font><br/><font id="yui_3_16_0_1_1448975735269_9820" size="3">     Cell 720-320-0155 <br /></font><br /><font
id="yui_3_16_0_1_1448975735269_9522"size="3" style="font-weight:bold;"><span id="yui_3_16_0_1_1448975735269_9521"
style="color:rgb(128,0, 255);">I reserve the right to fantasize.  Whether or not you </span><br style="color:rgb(128,
0,255);" /><span id="yui_3_16_0_1_1448975735269_9565" style="color:rgb(128, 0, 255);">wish to share my fantasy is
entirelyup to you. </span><img data-id="9db6a728-01b9-a11c-946d-640120b15096"
src="http://us.i1.yimg.com/us.yimg.com/i/mesg/tsmileys2/01.gif"style="color:rgb(128, 0, 255);" /><br /><br
/>www.youtube.com/unusedhero<brstyle="color:rgb(128, 0, 255);" /></font><br /><font
id="yui_3_16_0_1_1448975735269_9520"size="3"><span id="yui_3_16_0_1_1448975735269_9519"
style="font-weight:bold;font-family:courier;">FolkAlley - All Folk - 24 Hours a day </span><span
style="font-weight:bold;font-family:courier;"><br/>www.folkalley.com<br /><br /></span></font></div></div><br /><div
id="yui_3_16_0_1_1448975735269_9570"style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size:
24px;"><divid="yui_3_16_0_1_1448975735269_9569" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial,
LucidaGrande, sans-serif; font-size: 16px;"><div dir="ltr" id="yui_3_16_0_1_1448975735269_9568"><hr
id="yui_3_16_0_1_1448975735269_9567"size="1" /><font face="Arial" id="yui_3_16_0_1_1448975735269_9571" size="2">
<b><spanstyle="font-weight:bold;">From:</span></b> Wizz <mastuh8@gmail.com><br /><b><span style="font-weight:
bold;">To:</span></b>pgadmin-support@postgresql.org <br /><b><span style="font-weight: bold;">Sent:</span></b> Tuesday,
December1, 2015 7:41 AM<br /><b><span style="font-weight: bold;">Subject:</span></b> [pgadmin-support] Accessing SQL
thathas been executed behind the interface<br /></font></div><div class="y_msg_container"
id="yui_3_16_0_1_1448975735269_9572"><br/>How can I access the SQL that executes when I alter my tables with the<br
/>pgAdmininterface.<br />For instance, if I add a column, without a doubt, there was a "ALTER TABLE<br />tablename ADD
COLUMNcolumn name int;" executed in the background. How do I<br />get to it?<br />I need to make a bunch of changes to
adatabase and then have those changes<br />in the form of SQL so I can pass it on to a colleague, who will execute
it<br/>on an identical database.<br />Thank you!<br /><br /><br /><br />--<br />View this message in context: <a
href="http://postgresql.nabble.com/Accessing-SQL-that-has-been-executed-behind-the-interface-tp5875650.html"
target="_blank">http://postgresql.nabble.com/Accessing-SQL-that-has-been-executed-behind-the-interface-tp5875650.html</a><br
/>Sentfrom the PostgreSQL - pgadmin support mailing list archive at Nabble.com.<br /><br /><br />-- <br />Sent via
pgadmin-supportmailing list (<a href="mailto:pgadmin-support@postgresql.org"
ymailto="mailto:pgadmin-support@postgresql.org">pgadmin-support@postgresql.org</a>)<br/>To make changes to your
subscription:<br/><a href="http://www.postgresql.org/mailpref/pgadmin-support"
target="_blank">http://www.postgresql.org/mailpref/pgadmin-support</a><br/><br /><br /></div></div></div></div>