Ummmm. Postgresql doesn't natively support cross database queries...
On Thu, 12 Feb 2004, Stef wrote:
> Hey there everyone.
>
> Sorry for what seems to be a rather strange
> thought but, could we change the seperator used to
> distinguish 'cross-database' vs 'cross-schema' ?
>
> For example, i would expect the following
> to work:
>
> CREATE OR REPLACE FUNCTION test_autohist() RETURNS trigger
> AS 'BEGIN
> INSERT INTO history.test2 VALUES (new.field1,history.test_hist.nextval(), new.field2, new.field3,
new.field4,new.creation_id, new.creation_date, new.creation_id, new.creation_date);
> RETURN ;
> END;' LANGUAGE 'plpgsql';
>
> CREATE TRIGGER test_autohist_trig
> AFTER INSERT OR UPDATE ON test
> FOR EACH ROW
> EXECUTE PROCEDURE test_autohist();
>
>
> However, when i try it, as far as i can tell,
> the planner parses it down, finds that the schema isnt
> in the current 'search_path' and thus thinks its a cross
> database call.
>
> I understand that it may take the planner a
> while to go through all the available schema's to then
> deduce that it isnt infact a schema at all and return
> the fact that 'cross-database queries are currently not
> implemented', therefore, in the realm of crazy idea,
> would it be possible to change the notation to reference
> another db ?
>
> I was thinking something along the lines of '@',
> but i guess any other non-important ascii character would
> make sense.
>
> That way, the planner could decide wether or not
> to attempt a schema resolution (history.table1) or database
> resolution (live@table4).
>
>
> Please note, i am not asking for any sort of
> 'make cross-database work', merely asking if some sort
> of 'clarification' between cross-database and cross-schema
> would be beneficial.
>
> Ideas ? Comments ?
>
> regards
> Stef
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>