Is there a way to write such a SELECT statement with the
named parameter in PostgreSQL?
The server, and its prepared SQL capability, doesn’t understand named parameters. Only numbered ones.
That said, there are a number of different ways to write and execute SQL available to you and each of those provides different extended capabilities. For instance, psql and its variables feature.
David J.