Redirect sequence access to different schema

From: Magnus Reftel <magnus(dot)reftel(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Redirect sequence access to different schema
Date: 2010-07-25 19:01:04
Message-ID: 51D79104-16E2-4A35-B5AC-9616B3A320E4@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I'm trying to inject some behavior via rules between an application and a table schema, preferably without modifying either of them. Using views, I'm able to have a query that is run with one schema as the search_path to actually run against a table in a different schema. Is that also possible for sequences somehow? I tried creating a view like so:

create view myseq as select * from other_schema.foo_id_seq;

but when I run "select nextval('myseq');" I get an error saying that myseq "is not a sequence". What other options are there?

Best Regards
Magnus Reftel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lyle 2010-07-25 19:25:23 Re: DROP CONSTRAINT IF EXISTS - simulating in 7 and 8?
Previous Message Michael A. Peters 2010-07-25 15:58:58 Re: pg_dump, shemas, backup strategy