I have a schema
foo_bar but also
foo_x. During a particular session, is it possible to just set
bar in PostgreSQL (8.4)?
I don't think you can. If you check the documentation on
ALTER SCHEMA (PostgreSQL 8.4), there is not such a thing as
ALTER SCHEMA TEMPORARILY or anything similar.
What you could actually do (per session), is change your
search_path setting. Citing the documentation:
This variable specifies the order in which schemas are searched when an object (table, data type, function, etc.) is referenced by a simple name with no schema component. When there are objects of identical names in different schemas, the one found first in the search path is used. An object that is not in any of the schemas in the search path can only be referenced by specifying its containing schema with a qualified (dotted) name.
Depending on your specific use-case (the need for a temporary change of schema name wasn't mentioned), this might be helpful.