Stef <stef@chronozon.artofdns.com> writes:
> 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);
Why would you expect that to work?
The problem is with this bit:history.test_hist.nextval()
which is a cross-database function reference per the standard SQL syntax
for such things. (If you were in the history database, it wouldn't be
cross-database, but would refer to the nextval() function in the local
test_hist schema.)
I am not sure what you meant here, but I cannot see any need to
introduce a nonstandard syntax to resolve it.
regards, tom lane