Re: Redirect sequence access to different schema - Mailing list pgsql-general

From Joe Conway
Subject Re: Redirect sequence access to different schema
Date
Msg-id 4C4CA8ED.2020906@joeconway.com
Whole thread Raw
In response to Redirect sequence access to different schema  (Magnus Reftel <magnus.reftel@gmail.com>)
Responses Re: Redirect sequence access to different schema  (Magnus Reftel <magnus.reftel@gmail.com>)
List pgsql-general
On 07/25/2010 12:01 PM, Magnus Reftel wrote:
> 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?

It isn't clear (to me, at least) what you are trying to accomplish, but
does this do what you want?

create schema other_schema;
create SEQUENCE other_schema.foo_id_seq;

select current_schema;
 current_schema
----------------
 public
(1 row)

select nextval('other_schema.foo_id_seq');
 nextval
---------
       1
(1 row)

select nextval('other_schema.foo_id_seq');
 nextval
---------
       2
(1 row)

Joe

--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support


Attachment

pgsql-general by date:

Previous
From: Magnus Reftel
Date:
Subject: Redirect sequence access to different schema
Next
From: Magnus Reftel
Date:
Subject: Re: Redirect sequence access to different schema