RFC: Query Planner making a distinction between Cross Database and Cross Schema ?

From: Stef <stef(at)chronozon(dot)artofdns(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: RFC: Query Planner making a distinction between Cross Database and Cross Schema ?
Date: 2004-02-12 19:40:58
Message-ID: 20040212194058.GA2137@survivor.hades
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2004-02-12 20:14:27 Re: Transaction aborts on syntax error.
Previous Message Bruce Momjian 2004-02-12 19:35:42 Re: Transaction aborts on syntax error.