Re: Redirect sequence access to different schema

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Redirect sequence access to different schema
Дата
Msg-id 4C4CA8ED.2020906@joeconway.com
обсуждение исходный текст
Ответ на Redirect sequence access to different schema  (Magnus Reftel <magnus.reftel@gmail.com>)
Ответы Re: Redirect sequence access to different schema  (Magnus Reftel <magnus.reftel@gmail.com>)
Список 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


Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Magnus Reftel
Дата:
Сообщение: Redirect sequence access to different schema
Следующее
От: Magnus Reftel
Дата:
Сообщение: Re: Redirect sequence access to different schema