Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show executed query in phpPgAdmin

Is there a way to show the SQL query executed by phpPgAdmin as the way phpMyAdmin does? For example, if I modify a column, it should show the ALTER command being executed.

If this is not possible, what other interface could I use to get this feature?

like image 733
juanefren Avatar asked Nov 01 '10 22:11

juanefren


People also ask

How do I check my pgAdmin query history?

The upper panel displays the SQL Editor. You can use the panel to enter, edit, or execute a query. It also shows the History tab which can be used to view the queries that have been executed in the session, and a Scratch Pad which can be used to hold text snippets during editing.

How query is Execute in PostgreSQL?

To do this in PL/pgSQL, use the PERFORM statement: PERFORM query ; This executes query and discards the result. Write the query the same way you would write an SQL SELECT command, but replace the initial keyword SELECT with PERFORM .


2 Answers

It's not possible with any currently released version of phpPgAdmin, although the feature could probably be added. You'd need to intercept the SQL being sent to the back-end, and then display this back out to the user. SQL execution is pretty well centralized, and if you look at the "history" feature you will see a way to trap/show queries, so munging those bits together would probably get you what you want. HTH, if someone implements this, please send a pull request!

like image 112
xzilla Avatar answered Sep 30 '22 22:09

xzilla


As a quick dirty hack you could alter sources a bit to enable sql logging: In classes/database/ADODB_base.php in

function execute($sql) {
...
}

add these lines at the beginning:

global $misc;
$misc->saveScriptHistory($sql);

This worked in my 5.0.3 version.

like image 25
biomancer Avatar answered Sep 30 '22 23:09

biomancer