Fwd: Re: increment counter in VIEW - Mailing list pgsql-novice

From Richard Broersma Jr
Subject Fwd: Re: increment counter in VIEW
Date
Msg-id 20060713135513.68572.qmail@web31806.mail.mud.yahoo.com
Whole thread Raw
List pgsql-novice
oops,  forgot to reply all.
> > Dear All,
> > Thank you very much for your answers. I just want to summarize:
> > 1. create sequence:
> >     CREATE SEQUENCE myseq;
> >
> > 2. insert sequence function calls into VIEW:
> > CREATE OR REPLACE VIEW my_view AS SELECT
> >       nextval('myseq')::text AS test,
> >        knoten.knoten,
> > FROM
> >         setval('myseq',1),
> >         knoten knoten
> > WHERE
> >          knoten.knoten::text = knoten_flaeche.knoten::text;
> >
> > In Postgres it seems to work fine, but not yet in my application.
> > My doubt is about setval('myseq',1). I am not sure that it will always
> > works fine when I access view from my application. For example when I
> > call on_update rule.
>
> Maybe use a set returning function.  So people on the list call it a store procedure.
> http://www.postgresql.org/docs/8.1/interactive/xfunc-sql.html
>
> This way to can add for than one SQL statement to the fuction.  1 to reset your sequence and 1
> to
> display your query.
>
> Regards,
>
> Richard Broersma Jr.
>


pgsql-novice by date:

Previous
From: Oleg
Date:
Subject: Re: increment counter in VIEW
Next
From: Richard Broersma Jr
Date:
Subject: Re: increment counter in VIEW