Is it possible to send meta-commands to PostgreSQL through Unix TCP socket?

All we need is an easy explanation of the problem, so here it is.

Is it possible to be send meta-commands to PostgreSQL through Unix TCP socket?

Because I can query the DB, but when I try to send meta-commands like \d, \l, and so on, I am getting C42601 Message:

syntax error at or near "\".

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Those are commands implemented by psql only and they are not understood by the server. So there is no point sending them to the server.

If you want to find out which SQL statements psql uses for each of the meta-commands, start it with the option --echo-hidden. It then logs each SQL query that is used to implement the meta-commands.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply