[pgrouting-users] RFC3 Positional and named parameters on pgRouting functions

Vicky Vergara vicky at georepublic.de
Thu Oct 25 10:06:42 PDT 2018


Hi Dave,

"Normally" people use functions with positional parameters.
(about my quotes in words read [1])

Using proposed function *pgr_dijkstraCost* as example:

When you write a function call:
SELECT * FROM *pgr_dijkstraCost*('SELECT * from edge_table', 2, 3);
SELECT * FROM* pgr_dijkstraCost*('SELECT * from edge_table', 2, 3, false);
This works also (mixed)
SELECT * FROM *pgr_dijkstraCost*('SELECT * from edge_table', 2, 3,
directed:=false);

No one has complained that this can't be done on 2.6 (or for the last 2
years for that matter) on the function *pgr_dijkstraCost*:
SELECT * FROM *pgr_dijkstraCost*(edge_sql:='SELECT * from edge_table',
start_vid:=2, end_vid:=3);
I would think that is because "normally" people use functions with
positional parameters.

The changes are on the function calls, not on the function's return column
names.

So if you application has a wrapper:
CREATE FUNCTION mywarper1(...)
.....
RETURN QUERY
SELECT end_vid, cost FROM *pgr_dijkstraCost*('SELECT * from edge_table', 2,
3);
....

The columns end_vid & cost names are not changed, so your warpper is ok

In the case of *pgr_dijkstra*
in 2.6 this can be done
SELECT * FROM *pgr_dijkstra*(end_vid:=3, start_vid:=2, edge_sql:='SELECT *
from edge_table');

So if you application has a wrapper:
CREATE FUNCTION mywarper2(...)
.....
RETURN QUERY
SELECT * FROM *pgr_dijkstra*(end_vid:=3, start_vid:=2, edge_sql:='SELECT *
from edge_table');
....

you will need to change your wrapper
CREATE FUNCTION mywarper2(...)
.....
RETURN QUERY
SELECT * FROM *pgr_dijkstra*('SELECT * from edge_table', 2, 3);
....

But the output columns are not affected, so other queries that use the
mywrapper2 should remain the same

Regards
Vicky

[1] https://twitter.com/jodygarnett/status/1054257267095171072






On Thu, Oct 25, 2018 at 12:42 AM Dave Potts <mrdapotts at gmail.com> wrote:

> Can we ensure that the following issues are taken care of
>
> Its clearly explained how to port old code to use the new systems for the
> last years worth of releases.
> Any attempt to use old signature method name with a new signature some
> results in some type of massive error along the lines your need to update
> you code.
> The current documentation is updated.
> Any new code or code that is being developed  has to use the new methods
>
> There is a lot of old code out there, we need a clear method of ensure it
> can be updated by somebody who has never seen pgrouting before
>
> On Wed, 24 Oct 2018 at 19:44, Vicky Vergara <vicky at georepublic.de> wrote:
>
>> Dear Users and developers
>>
>> We would like to hear your feedback about:
>> Positional and named parameters on pgRouting functions
>> That is described here:
>> https://github.com/pgRouting/admin/wiki/RFC3
>>
>> The aim is to enforce positional notation on compulsory parameters and
>> allow named notation on optional parameters
>> That enforcement would take place on version 3.0.0 scheduled to be
>> released on September 2019.
>>
>> We will appreciate your feedback.
>>
>> Regards
>>
>> The pgRouting team
>>
>>
>>
>>
>> --
>>
>> Georepublic UG (haftungsbeschränkt)
>> Salzmannstraße 44,
>> 81739 München, Germany
>>
>> Vicky Vergara
>> Operations Research
>>
>> eMail: vicky at georepublic.de
>> Web: https://georepublic.info
>>
>> Tel: +49 (089) 4161 7698-1
>> Fax: +49 (089) 4161 7698-9
>>
>> Commercial register: Amtsgericht München, HRB 181428
>> CEO: Daniel Kastl
>>
>>
>> _______________________________________________
>> Pgrouting-users mailing list
>> Pgrouting-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/pgrouting-users
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/pgrouting-users



-- 

Georepublic UG (haftungsbeschränkt)
Salzmannstraße 44,
81739 München, Germany

Vicky Vergara
Operations Research

eMail: vicky at georepublic.de
Web: https://georepublic.info

Tel: +49 (089) 4161 7698-1
Fax: +49 (089) 4161 7698-9

Commercial register: Amtsgericht München, HRB 181428
CEO: Daniel Kastl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20181025/d673d2d7/attachment.html>


More information about the Pgrouting-users mailing list