<div dir="ltr"><div>This is more of a General Postgres Question, but you can use row_number for this.</div><div><br></div><div><br></div><div>You can use it to make a Materilized View as follows:</div><div><br></div><div><br></div><div>CREATE MATERIALIZED VIEW public.my_view<br>TABLESPACE pg_default<br>AS<br> SELECT row_number() OVER () AS id,</div><div>foo.* FROM(</div><div>Select a.*, b.*<br></div><div>From tablea a</div><div>JOIN tableb b on <a href="http://a.id">a.id</a>=<a href="http://b.id">b.id</a></div><div>) foo</div><div>WITH DATA;</div><div><br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font size="2" color="#999999">Regards,</font><div><font size="2" color="#444444">Devdatta</font></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 17, 2019 at 3:19 PM Shaozhong SHI <<a href="mailto:shishaozhong@gmail.com">shishaozhong@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Can anyone advise?<div><br></div><div>Regards,</div><div><br></div><div>Shao</div></div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote></div>