[postgis-users] How to create or alter set a unique ID field in materialized view?

Devdatta Tengshe devdatta at tengshe.in
Tue Sep 17 03:53:00 PDT 2019


This is more of a General Postgres Question, but you can use row_number for
this.


You can use it to make a Materilized View as follows:


CREATE MATERIALIZED VIEW public.my_view
TABLESPACE pg_default
AS
 SELECT row_number() OVER () AS id,
foo.* FROM(
Select a.*, b.*
>From tablea a
JOIN tableb b on a.id=b.id
) foo
WITH DATA;


Regards,
Devdatta


On Tue, Sep 17, 2019 at 3:19 PM Shaozhong SHI <shishaozhong at gmail.com>
wrote:

> Can anyone advise?
>
> Regards,
>
> Shao
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190917/a4c459ab/attachment.html>


More information about the postgis-users mailing list