<div dir="ltr">Right now Select ST_AsText(ST_MakePoint(1,2,4326)) returns POINT Z (1 2 4326)<div>Are we going to have to cast the input every time to make sure it's a SRID?  That might be more confusing than ST_SetSRID(ST_MakePoint())</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 16, 2020 at 11:41 AM Paul Ramsey <<a href="mailto:pramsey@cleverelephant.ca">pramsey@cleverelephant.ca</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">I feel like we've been over this before, but I ran into it again and I'm wondering what we think our best practice should be.<br>
<br>
The issue is the removal of stacked multi-parameter functions. We have:<br>
<br>
  CREATE FUNCTION ST_MakePoint(float8, float8)<br>
  CREATE FUNCTION ST_MakePoint(float8, float8, float8)<br>
  CREATE FUNCTION ST_MakePoint(float8, float8, float8, float8)<br>
<br>
What's missing here? A place to set the SRID! So we constantly have this formation:<br>
<br>
  ST_SetSRID(ST_MakePoint(...), ...)<br>
<br>
Which is, let's face it, ugly. So being a smart boy I thought:<br>
<br>
  CREATE FUNCTION ST_MakePoint(x float8, y float8, z float8 default null, m float8 default null, srid integer default null)<br>
<br>
And then I updated the underlying C function to handle the nulls, and it works wonderfully:<br>
<br>
  postgis=# select st_asewkt(ST_MakePoint(1, 2, srid => 123));<br>
  SRID=123;POINT(1 2)<br>
<br>
Except, unfortunately now the old form is broken.<br>
<br>
  postgis=# select st_asewkt(ST_MakePoint(1.2, 2.33)); <br>
  ERROR:  function st_makepoint(double precision, double precision) is not unique<br>
  HINT:  Could not choose a best candidate function. You might need to add explicit type casts.<br>
<br>
Yeah, it could be either my new one or the two-parameter form of the old one.<br>
<br>
The obvious fix would be to remove the old signatures at the same time as adding the new one, but as I recall this leads to upgrade issues? This is where my memory is failing. I know (a) a single signature with defaults and argument names is nicer and cleaner and also (b) every time I've done it there's been some kind of an outcry / mess.<br>
<br>
Any help, thoughts?<br>
<br>
P<br>
_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a><br>
</blockquote></div>