postgresqlprotocolspsql

execute postgres extended query in postgresql via psql


How can I execute a postgresql query via psql command-line in extended mode (means I want to see Parse, Bind, and Execute packets)?

I have executed PREPARE and EXECUTE commands but as I captured sent packets via Wireshark I saw that they are sent as "Simple Query" packets.


Solution

  • Both the PREPARE and the EXECUTE statements are SQL statements and will be sent as simple query (Q).

    If you want to see Bind, Parse and Execute packets, you'll have to write some code. Virtually every PostgreSQL interface can use extended mode.

    Write a little program in C, Java, Python or some other language of your choice.