PQgetvalue alternative in SQL code?
PQgetvalue() is a client-side function that does not create anything, it just returns the value of a field inside a resultset.

The server-side equivalent, say select SomethingLikePQgetvalue('cats' || ' dogs')
would simply be select 'cats' || ' dogs'. Or if it isn't, please give an example showing when it would differ.

If the goal is to reinject the value as a literal into another SQL statement, then the SQL function quote_literal can be used.