PostgreSQL – SET CONNECTION Error ‘Unrecognized Configuration Parameter’

connectionspostgresql

According to the PostgreSQL documentation, there appears to be support for SET CONNECTION.

However, when I try to execute it from the psql prompt, I get

ERROR: unrecognized configuration parameter "connection"

I'm well aware of using \connect but I want to be able to switch databases within the execution of a .sql file.

Is this a bug in PostgreSQL? Or does some flag need to be set to create the parameter?

Best Answer

Converting question comments into an answer

Abelisto:

It seems that you missed a section of the documentation: Chapter 34. ECPG - Embedded SQL in C. The PostgreSQL documentation is not ideal (but IMO it is much better then many others). Hint: to avoid inconveniences look at the page name in the address, for example plpgsql-declarations.html is about DECLARE variables in the plpgsql blocks and sql-declare.html is about DECLARE cursors in the pure SQL.

dezso:

If using psql, you still can make use of \c - especially if it does not require typing a password.