Postgres select only if table exists
Do you run it in some kind of a function? If not, this whole question makes no sense... If yes - simply try to catch the error, as described here: http://www.postgresql.org/docs/9.1/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
You would need to trap 42P01 undefined_table
SQLSTATE.
So in your function you could do:
BEGIN SELECT * FROM sometableEXCEPTION WHEN undefined_table THEN -- Do something WHEN others THEN -- Do something elseEND;
As an addtional note (not related to Postgresql), when you start the Odoo server, you should ensure that the -u flag is set to ensure that your odoo customization is applied by the Odoo ORM. This ensure that any modifications you have made such as table creation/modification is applied to your Postgresql DB.
So, from the CLI:
openerp-server -u module_name
or
openerp-server -u all
to update all modules