I had the error cross-database references are not implemented: scan.location.alias with this PL/pgSQL code:
DECLARE
v_tmp_host scan.location.alias%TYPE;
v_ip_address character varying;
BEGIN
-- Some assignment to v_ip_address
v_tmp_host := v_ip_address::scan.location.alias%TYPE;
Since the code was working for a long time, I investigated and found out, that "scan" is a schema in the database this trigger exists in and someone created a database called "scan" some days ago. Since now "scan" is a db as well as a schema, pg seems to use the db instead of the schema.
My question is, how can I avoid such problems in future? How should I write this code to don't get broken by creating additional relations, databases or schemas?
Or in other words: How can I force pg to use the schema and not the db in this situation?
locationtables in other schemas? – dezso Nov 20 '12 at 9:46