<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 29, 2013 at 1:17 PM, Daniel Kastl <span dir="ltr"><<a href="mailto:daniel@georepublic.de" target="_blank">daniel@georepublic.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">
<div><div class="h5">On Wed, May 29, 2013 at 12:53 PM, Stephen Woodbridge <span dir="ltr"><<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On 5/28/2013 11:40 PM, Daniel Kastl wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
<br>
<br>
<br>
On Wed, May 29, 2013 at 12:18 PM, Stephen Woodbridge<br></div><div><div>
<<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a> <mailto:<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.<u></u>com</a>>> wrote:<br>
<br>
On 5/28/2013 10:14 PM, Daniel Kastl wrote:<br>
<br>
<br>
What about just one "pgr_version()" function?<br>
I don't get the use case where we need two of them ;-)<br>
<br>
I think "pgr_version()" should then return the "full" version.<br>
<br>
<br>
I'm fine with have to two functions.<br>
<br>
pgr_full_version() - this would be the full string with everything<br>
pgr_version() - this should match version of extension like:<br>
2.0.0-dev in pgrouting--2.0.0-dev.sql<br>
<br>
The full version string is what we want for bug reporting.<br>
The version is what you might want to use in an application to<br>
construct if clauses based on features available in this or that<br>
version of the software.<br>
<br>
<br>
What about<br>
<br>
pgr_version() -> should match version of extension<br>
pgr_version("full") -> full string with everything (could be also "debug")<br>
<br>
I know this is not really important discussion, but we did so well in<br>
decreasing the number of functions and then we're having multiple ones<br>
for just getting the version information ;-)<br>
Also I had to add two pages to the function reference somehow.<br>
<br>
I still like the idea to return a record, because someone could pick<br>
what is important if used for an application, like:<br>
<br>
SELECT * FROM pgr_version();<br>
<br>
version | tag | build | hash | branch<br>
----------+---------+-------+-<u></u>---------+---------------<br>
2.0.0-dev | v2.0dev | 271 | g6eeef9b | sew-devel-2_0<br>
<br>
So one could get the version with SELECT version FROM pgr_version() in<br>
case they really use it for some application for example;<br>
</div></div></blockquote>
<br>
This would require defining a new TYPE, I suppose I we could return text[] then you could use array_to_string() to concat them with hyphens.<br>
<br>
I don't like the idea of passing arguments to get different strings, because I have not seen it on any other apps.<br></blockquote><div><br></div></div></div><div>Me neither. I would prefer to query for attributes as well.</div>
<div class="im">
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I would just have leave it as two functions and put them both on one doc page. Or if you want it parsed return a text[] array. I'm happy to make the changes that is trivial.<br></blockquote><div><br></div></div><div>
Do you really need to define new types to return a table?</div><div><br></div><div>I just did it like this in another function variant:</div><div><a href="https://github.com/pgRouting/pgrouting/blob/sew-devel-2_0/src/common/sql/pgrouting_network_check.sql" target="_blank">https://github.com/pgRouting/pgrouting/blob/sew-devel-2_0/src/common/sql/pgrouting_network_check.sql</a><br>
</div><div><br></div><div>I didn't have to create a type for that.</div><div><br></div></div></div></div></blockquote><div><br></div><div><br></div><div style>I tried this and it works pretty well:</div><div style><br>
</div><div style><div><font face="courier new, monospace">CREATE OR REPLACE FUNCTION public.pgr_version()</font></div><div><font face="courier new, monospace"> RETURNS TABLE(</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre"> </span>"version" varchar, </font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre"> </span>tag varchar,</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre"> </span>build varchar,</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre"> </span>hash varchar,</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre"> </span>branch varchar</font></div>
<div><font face="courier new, monospace">) AS</font></div><div><font face="courier new, monospace">$BODY$</font></div><div><font face="courier new, monospace">DECLARE</font></div><div><font face="courier new, monospace"><br>
</font></div><div><font face="courier new, monospace">BEGIN</font></div><div><font face="courier new, monospace"> --return '2.0.0-dev v2.0dev-285-g101f36a sew-devel-2_0';</font></div><div><font face="courier new, monospace"> RETURN QUERY SELECT '2.0.0-dev'::varchar AS version,'v2.0dev'::varchar AS tag, </font></div>
<div><font face="courier new, monospace"> '285'::varchar AS build, 'g101f36a'::varchar AS hash, </font></div><div><font face="courier new, monospace"> 'sew-devel-2_0'::varchar AS branch;</font></div>
<div><font face="courier new, monospace">END;</font></div><div><font face="courier new, monospace">$BODY$</font></div><div><font face="courier new, monospace"> LANGUAGE plpgsql IMMUTABLE</font></div><div> COST 100;</div>
</div><div style><br></div><div style>You can run either with "SELECT * FROM pgr_version()"</div><div style><br></div><div style><div> psql -U postgres -d doc -c "SELECT * FROM public.pgr_version()"</div>
<div> version | tag | build | hash | branch </div><div>-----------+---------+-------+----------+---------------</div><div> 2.0.0-dev | v2.0dev | 285 | g101f36a | sew-devel-2_0</div><div>(1 row)</div><div>
<br></div><div style>Or just "SELECT pgr_version()"</div></div><div style><br></div><div style><div>psql -U postgres -d doc -c "SELECT public.pgr_version()"</div><div> pgr_version </div>
<div>------------------------------------------------</div><div> (2.0.0-dev,v2.0dev,285,g101f36a,sew-devel-2_0)</div><div>(1 row)</div><div><br></div><div style>I think this should satisfy everyone. No? ;-)</div><div style>
<br></div><div style>Daniel</div></div><div style><br></div><div style><br></div><div style> </div></div><br clear="all"><div><br></div>-- <br><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG & Georepublic Japan<br>
eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66,99,171)" target="_blank">daniel.kastl@georepublic.de</a><br>Web: <a href="http://georepublic.de/" style="color:rgb(66,99,171)" target="_blank">http://georepublic.de</a></span>
</div></div>