<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;}
@font-face
{font-family:"Segoe UI Emoji";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
span.gmailsignatureprefix
{mso-style-name:gmail_signature_prefix;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Jeevan,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So you are saying adding a dependency of spatial_ref_sys for geometry and geography should be sufficient to have the spatial_ref_sys data loaded for those before any user data with said columns?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I can’t think of a case where ST_Transform would be used in a table definition where there wouldn’t be a geometry/geography column definition nearby. So I suppose we can put in PostGIS 3.6.<o:p></o:p></p><p class=MsoNormal>I wouldn’t want to backport it without extensive testing though.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Jeevan Chalke <jeevan.chalke@enterprisedb.com> <br><b>Sent:</b> Wednesday, July 2, 2025 5:01 AM<br><b>To:</b> Regina Obe <lr@pcorp.us><br><b>Cc:</b> Laurenz Albe <laurenz.albe@cybertec.at>; Paul Ramsey <pramsey@cleverelephant.ca>; PostGIS Development Discussion <postgis-devel@lists.osgeo.org><br><b>Subject:</b> Re: pg_upgrade fails due to lack of dependencies.<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Wed, Jul 2, 2025 at 3:03<span style='font-family:"Arial",sans-serif'> </span>AM Regina Obe <<a href="mailto:lr@pcorp.us">lr@pcorp.us</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal>> > Yes that's a no go for 2 reasons<br>> ><br>> > 1) As you saw with the example mentioned, many people build indexes etc<br>> > around this function. If it were marked stable it would prevent usage<br>> > in indexes etc. The medicine would be way worse than the sickness.<br>> <br>> Even if the sickness is index corruption and inability to upgrade and restore a<br>> dump?<br>> <br><br>YES. It's only pg_upgrade people have issues with cause it doesn't load all extension objects first like regular restores do. If you can't restore these with pg_upgrade, just restore them the old fashioned way.<br>Changing the functions to stable, means people can't create such indexes in the first place or use ST_Transform in their computed columns.<br>So it's the same as saying "If you don't want to feel pain, don't do that" vs. "We just won't let you do that"<br><br>Usually people that do these kinds of things are fairly clever, they are smart enough to find a way out of it without us snatching the gun from their hand and they'll scream if we try to grab their footgun from them.<br><br><br><br>> > 2) We tried making it stable like 10 years ago, and that made the function<br>> > super unbearably slow. Maybe things have changed since then, but the<br>> > case 1 is still an issue.<br>> <br>> Could that have been problems around inlining that git solved with optimizer<br>> support functions in v12?<br><br>We could revisit to see that - could be.<br>> <br>> > > However, that dependency does not extend to the data in<br>> > > "spatial_ref_sys", so using the function in a generated column is still a<br>> problem.<br>> ><br>> > Yap my main concern. But in case of pg_upgrade, since the data is<br>> > overlaid, at what point does it record, there is data in spatial_ref_sys?<br>> <br>> I didn't scrutinize the code, but the table data seem to get dumped in<br>> alphabetical order of "schemaname.tablename".<br>> <br><br>Okay so then a dependency wouldn't be guaranteed to help them.<o:p></o:p></p></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Not exactly.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>While it's true that objects are initially considered for dumping in alphabetical order, as mentioned earlier, <code><span style='font-size:10.0pt'>pg_dump</span></code> is smart enough to analyze <code><span style='font-size:10.0pt'>pg_depend</span></code> and reorder dependent objects to ensure they are dumped and restored in the correct order.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal>A simpler solution would be install postgis in a dedicated schema like I always tell people to do. In addition make sure that schema is alphabetically ahead of user data <span style='font-family:"Segoe UI Emoji",sans-serif'>😊</span><o:p></o:p></p></blockquote><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'><br><br>> > The other discussion we had had, which I know Paul wants to throw up<br>> > everytime I mention it is to get rid of spatial_ref_sys and read<br>> > directly from the proj.db sqlite db that has the definitions.<br>> > Most of the time postgis just uses the proj.db def anyway.<br>> <br>> How IMMUTABLE is that?<br>> <br><br>For most users it's pretty IMMUTABLE but could change with proj upgrades, but it really doesn't matter is spatial_ref_sys is there or not<br>cause ultimately if the definition of an srid is in that proj.db that is what will be used. Since proj.db is a separate file altogether, not part of PostgreSQL<br>it won't be screwed up by pg_upgrade not finding data. Probably the same story as your collations/fulltext dictionaries etc.<br><br>I think Paul had issue with <br><br>Sometimes people want to make changes, and they have no access to file system if they are on DbaaS<br><br>Proj itself does have a mechanism of users keeping their own custom projections separate from the ones proj ships but that feature probably isn't available if you are on a DbaaS<br>Which a large majority of users are these days.<o:p></o:p></p></blockquote></div><div><p class=MsoNormal><br clear=all><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><span class=gmailsignatureprefix>-- </span><o:p></o:p></p><div><div><div><div><div><div><div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><img border=0 width=200 height=37 style='width:2.0833in;height:.3854in' id="_x0000_i1025" src="https://ci3.googleusercontent.com/mail-sig/AIorK4wUmLsFZCrsP0IzlqcrOBS4LG-QdOAM_CPz15Rip0P4elztKb7pS0FF_Tbb_lCOORByN9lcXUTXqe-8"><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><b>Jeevan Chalke</b><br><i><span style='font-family:"Arial",sans-serif;color:#1D1C1D'>Principal Engineer, Engineering Manager</span><br>Product Development</i><br><b><span style='font-size:11.0pt;font-family:"Arial",sans-serif;color:#FF3E00;background:white'><br><a href="https://www.enterprisedb.com" target="_blank">enterprisedb.com</a></span></b><o:p></o:p></p></div></div></div></div></div></div></div></div></div></div></div></body></html>