diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index d2d698b0ba..2d1e37b90a 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -52,6 +52,9 @@ jobs: strategy: fail-fast: false + matrix: + release: [Debug, Release] + os: [ubuntu-latest, ubuntu-22.04] steps: - uses: actions/checkout@v4 @@ -64,12 +67,21 @@ jobs: echo "PGIS=3" >> $GITHUB_ENV echo "PGPORT=5432" >> $GITHUB_ENV + - name: 'Raise Priority for apt.postgresql.org' + run: | + cat << EOF >> ./pgdg.pref + Package: * + Pin: release o=apt.postgresql.org + Pin-Priority: 600 + EOF + sudo mv ./pgdg.pref /etc/apt/preferences.d/ + sudo apt update + - name: Add PostgreSQL APT repository run: | - sudo apt-get install curl ca-certificates gnupg - curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ \ - $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo apt-get purge postgresql-* + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg-testing main ${PGVER}" > /etc/apt/sources.list.d/pgdg.list' + curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null - name: Install dependencies run: | @@ -84,13 +96,13 @@ jobs: postgresql-${PGVER}-postgis-${PGIS}-scripts \ postgresql-server-dev-${PGVER} - - name: Configure + - name: Configure for clang run: | export PATH=/usr/lib/postgresql/${PGVER}/bin:$PATH mkdir build cd build CXX=clang++ CC=clang cmake -DPOSTGRESQL_VERSION=${PGVER} \ - -DCMAKE_BUILD_TYPE=Debug -DBUILD_HTML=OFF -DBUILD_DOXY=OFF \ + -DCMAKE_BUILD_TYPE=${{ matrix.release }} -DBUILD_HTML=OFF -DBUILD_DOXY=OFF \ -DUSE_CLANG_TIDY=ON .. - name: Build diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e866dd565b..bdb4ba85d0 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -10,6 +10,11 @@ on: push: paths: - '.github/workflows/ubuntu.yml' + - 'src/**' + - 'include/**' + - 'pgtap/**' + - 'tools/testers/**' + - './CMakeLists.txt' branches-ignore: - 'gh-pages' @@ -31,6 +36,7 @@ jobs: matrix: psql: [13,14,15,16,17,18] postgis: [3] + release: [Debug, Release] os: [ubuntu-latest, ubuntu-22.04] steps: @@ -69,7 +75,8 @@ jobs: export PATH=/usr/lib/postgresql/${{ matrix.psql }}/bin:$PATH mkdir build cd build - cmake -DPOSTGRESQL_VERSION=${{ matrix.psql }} -DCMAKE_BUILD_TYPE=Release -DWITH_DOC=OFF .. + cmake -DPOSTGRESQL_VERSION=${{ matrix.psql }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.release }} -DBUILD_HTML=OFF -DBUILD_DOXY=OFF .. - name: Build run: | diff --git a/NEWS.md b/NEWS.md index 7708c36dcc..273f1a5933 100644 --- a/NEWS.md +++ b/NEWS.md @@ -146,7 +146,7 @@ Summary of changes by function * pgr_kingOrdering - * New experimental function. + * New experimental function. * pgr_KSP @@ -194,7 +194,7 @@ Summary of changes by function * pgr_trspVia_withPoints * Function promoted to official. - * **Driving side** parameter is positional unnamed and compulsory. + * **Driving side** parameter is positional unnamed. * Valid values depend on kind of graph * Breaking change, signatures no longer available: * pgr_trspvia_withpoints(text,text,text,anyarray,boolean,boolean,boolean,character,boolean) diff --git a/doc/categories/via-category.rst b/doc/categories/via-category.rst index deb5e6ca77..65da171f39 100644 --- a/doc/categories/via-category.rst +++ b/doc/categories/via-category.rst @@ -16,22 +16,13 @@ Via - Category .. official-start +* :doc:`pgr_dijkstraVia` * :doc:`pgr_withPointsVia` * :doc:`pgr_trspVia` * :doc:`pgr_trspVia_withPoints` .. official-end -.. include:: proposed.rst - :start-after: warning-begin - :end-before: end-warning - -.. proposed-start - -* :doc:`pgr_dijkstraVia` - -.. proposed-end - General Information ------------------------------------------------------------------------------- @@ -52,76 +43,34 @@ Parameters **Used in:** * :doc:`pgr_dijkstraVia` -* :doc:`pgr_trspVia` - -.. via_parameters_start - -.. list-table:: - :width: 81 - :widths: 14 20 7 40 - :header-rows: 1 - - * - Parameter - - Type - - Default - - Description - * - `Edges SQL`_ - - ``TEXT`` - - - - SQL query as described. - * - **via vertices** - - ``ARRAY`` [ **ANY-INTEGER** ] - - - - Array of ordered vertices identifiers that are going to be visited. - -Where: -:ANY-INTEGER: SMALLINT, INTEGER, BIGINT - -.. via_parameters_end +.. include:: pgr_dijkstraVia.rst + :start-after: via_parameters_start + :end-before: via_parameters_end **Used in:** * :doc:`pgr_withPointsVia` -* :doc:`pgr_trspVia_withPoints` - -.. via_withPoints_parameters_start - -.. list-table:: - :width: 81 - :widths: auto - :header-rows: 1 - * - Parameter - - Type - - Description - * - `Edges SQL`_ - - ``TEXT`` - - SQL query as described. - * - `Points SQL`_ - - ``TEXT`` - - SQL query as described. - * - **via vertices** - - ``ARRAY`` [ **ANY-INTEGER** ] - - Array of ordered vertices identifiers that are going to be visited. +.. include:: pgr_withPointsVia.rst + :start-after: via_withPoints_parameters_start + :end-before: via_withPoints_parameters_end - * When positive it is considered a vertex identifier - * When negative it is considered a point identifier - * - **driving side** - - ``CHAR`` - - Value in [``r``, ``R``, ``l``, ``L``, ``b``, ``B``] indicating if the driving side is: +**Used in:** - - [``r``, ``R``] for right driving side (for directed graph only) - - [``l``, ``L``] for left driving side (for directed graph only) - - [``b``, ``B``] for both (only for undirected graph) +* :doc:`pgr_trspVia` +.. include:: TRSP-family.rst + :start-after: via_parameters_start + :end-before: via_parameters_end -Where: +**Used in:** -:ANY-INTEGER: SMALLINT, INTEGER, BIGINT -:ANY-NUMERICAL: SMALLINT, INTEGER, BIGINT, REAL, FLOAT +* :doc:`pgr_trspVia_withPoints` -.. via_withPoints_parameters_end +.. include:: /pgr_trspVia_withPoints.rst + :start-after: trspvia_withPoints_parameters_start + :end-before: trspvia_withPoints_parameters_end Besides the compulsory parameters each function has, there are optional parameters that exist due to the kind of function. diff --git a/doc/categories/withPoints-category.rst b/doc/categories/withPoints-category.rst index 408a3bea3c..c2edbfc2ae 100644 --- a/doc/categories/withPoints-category.rst +++ b/doc/categories/withPoints-category.rst @@ -122,15 +122,34 @@ Parameters - ``ARRAY[BIGINT]`` - Array of identifiers of ending vertices. Negative values are for point’s identifiers. - * - **driving side** + +.. withPoints_parameters_end + +.. driving_side_start + +.. list-table:: + :width: 81 + :widths: 14 14 44 + + * - [**driving side**] - ``CHAR`` - Value in [``r``, ``R``, ``l``, ``L``, ``b``, ``B``] indicating if the driving side is: - - [``r``, ``R``] for right driving side (for directed graph only) - - [``l``, ``L``] for left driving side (for directed graph only) - - [``b``, ``B``] for both (only for undirected graph) + - For directed graph: -.. withPoints_parameters_end + - [``r``, ``R``] for right driving side + - [``l``, ``L``] for left driving side + + - For undirected graph: + + - [``b``, ``B``] for both driving sides + + - Default values when parameter is missing: + + - [``r``, ``R``] for directed graph + - [``l``, ``L``] for undirected graph + +.. driving_side_end Optional parameters ............................................................................... diff --git a/doc/dijkstra/pgr_dijkstraVia.rst b/doc/dijkstra/pgr_dijkstraVia.rst index c410b5938c..6e9fbacccf 100644 --- a/doc/dijkstra/pgr_dijkstraVia.rst +++ b/doc/dijkstra/pgr_dijkstraVia.rst @@ -8,13 +8,13 @@ **************************************************************************** .. index:: - single: Dijkstra Family ; pgr_dijkstraVia - Proposed - single: Via Category ; pgr_dijkstraVia - Proposed + single: Dijkstra Family ; pgr_dijkstraVia + single: Via Category ; pgr_dijkstraVia single: dijkstraVia - Proposed | -``pgr_dijkstraVia`` - Proposed +``pgr_dijkstraVia`` =============================================================================== ``pgr_dijkstraVia`` — Route that goes through a list of vertices. @@ -45,7 +45,7 @@ Signatures ------------------------------------------------------------------------------- .. index:: - single: dijkstraVia - Proposed ; One Via - Proposed on 2.2 + single: dijkstraVia ; One Via One Via ............................................................................... @@ -69,9 +69,31 @@ One Via Parameters ------------------------------------------------------------------------------- -.. include:: via-category.rst - :start-after: via_parameters_start - :end-before: via_parameters_end +.. via_parameters_start + +.. list-table:: + :width: 81 + :widths: 14 20 7 40 + :header-rows: 1 + + * - Parameter + - Type + - Default + - Description + * - `Edges SQL`_ + - ``TEXT`` + - + - SQL query as described. + * - **via vertices** + - ``ARRAY`` [ **ANY-INTEGER** ] + - + - Array of ordered vertices identifiers that are going to be visited. + +Where: + +:ANY-INTEGER: SMALLINT, INTEGER, BIGINT + +.. via_parameters_end Optional parameters ............................................................................... diff --git a/doc/metrics/pgr_bandwidth.rst b/doc/metrics/pgr_bandwidth.rst index 33b5b706af..3b9730c632 100644 --- a/doc/metrics/pgr_bandwidth.rst +++ b/doc/metrics/pgr_bandwidth.rst @@ -24,16 +24,18 @@ .. rubric:: Availability -.. rubic:: Version 4.0.0 +.. rubric:: Version 4.0.0 * New experimental function. Description ------------------------------------------------------------------------------- -Bandwidth measures how "spread out" the connections are in a graph when vertices are arranged in a linear order (like numbering them 1, 2, 3, etc.). +Bandwidth measures how "spread out" the connections are in a graph when vertices +are arranged in a linear order (like numbering them 1, 2, 3, etc.). -* For each edge in the graph, calculate the distance between the vertex numbers it connects +* For each edge in the graph, calculate the distance between the vertex numbers + it connects * The bandwidth is the maximum of all these distances * The implementation is for undirected graphs * Run time is 0.160789 seconds @@ -61,9 +63,9 @@ Signatures Parameters ------------------------------------------------------------------------------- -.. include:: pgRouting-concepts.rst - :start-after: edges_start - :end-before: edges_end +.. include:: allpairs-family.rst + :start-after: edges_start + :end-before: edges_end Inner Queries ------------------------------------------------------------------------------- diff --git a/doc/ordering/pgr_kingOrdering.rst b/doc/ordering/pgr_kingOrdering.rst index c1dadca874..ed00b0694a 100644 --- a/doc/ordering/pgr_kingOrdering.rst +++ b/doc/ordering/pgr_kingOrdering.rst @@ -24,14 +24,14 @@ .. rubric:: Version 4.0.0 - * New experimental function. +* New experimental function. Description ------------------------------------------------------------------------------- In numerical linear algebra and graph theory, the King ordering algorithm is a heuristic designed to reorder the vertices of a graph so as to reduce -its bandwidth. +its bandwidth. The method follows a breadth-first search (BFS) traversal,but with a refinement: at each step, the unvisited neighbors of the current vertex are inserted into diff --git a/doc/ordering/pgr_sloanOrdering.rst b/doc/ordering/pgr_sloanOrdering.rst index 9de67c5c7d..0ca4c0a99a 100644 --- a/doc/ordering/pgr_sloanOrdering.rst +++ b/doc/ordering/pgr_sloanOrdering.rst @@ -105,31 +105,31 @@ Additional Examples ..graphviz:: -graph G{ -node[shape=circle, style=filled, fillcolor=lightblue, color=black, fontcolor=black, fontsize=12]; -edge[color=black, penwidth=1.5]; - -0 -- 3; -0 -- 5; -1 -- 2; -1 -- 4; -1 -- 6; -1 -- 9; -2 -- 3; -2 -- 4; -3 -- 5; -3 -- 8; -4 -- 6; -5 -- 6; -5 -- 7; -6 -- 7; - -{rank=same; 0; 8;} -{rank=same; 3; 5; 7;} -{rank=same; 2; 4; 6;} -{rank=same; 1; 9;} - -} + graph G{ + node[shape=circle, style=filled, fillcolor=lightblue, color=black, fontcolor=black, fontsize=12]; + edge[color=black, penwidth=1.5]; + + 0 -- 3; + 0 -- 5; + 1 -- 2; + 1 -- 4; + 1 -- 6; + 1 -- 9; + 2 -- 3; + 2 -- 4; + 3 -- 5; + 3 -- 8; + 4 -- 6; + 5 -- 6; + 5 -- 7; + 6 -- 7; + + {rank=same; 0; 8;} + {rank=same; 3; 5; 7;} + {rank=same; 2; 4; 6;} + {rank=same; 1; 9;} + + } ..literalinclude::sloanOrdering.queries :start-after: --q3 @@ -141,7 +141,7 @@ See Also * :doc:`sampledata` * `Boost: Sloan Ordering - `__ + `__ .. rubric:: Indices and tables diff --git a/doc/src/migration.rst b/doc/src/migration.rst index 2cb4d24a37..390868664c 100644 --- a/doc/src/migration.rst +++ b/doc/src/migration.rst @@ -872,15 +872,18 @@ After updating pgRouting: * Use an unnamed valid value for **driving side** after the **distance** parameter. -.. note:: Validity of **driving side** parameter +.. note:: Default value of **driving side** parameter - **driving side** parameter is unnamed compulsory, and valid values differ for + **driving side** parameter is unnamed, and valid values differ for directed and undirected graphs. - * Does not have a default value. * In directed graph: valid values are [``r``, ``R``, ``l``, ``L``] + + * Default value = 'r'; + * In undirected graph: valid values are [``b``, ``B``] - * Using an invalid value throws an ``ERROR``. + + * Default value = 'b'; Single vertex example using ``pgr_withPointsDD`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1443,7 +1446,7 @@ Starting from `v3.6.0 `__ :from: |ksp-result| :to: |generic-result| -And ``driving side`` parameter changed from named optional to unnamed compulsory +And ``driving side`` parameter changed from named optional to unnamed **driving side** and its validity differ for directed and undirected graphs. Signatures to be migrated: @@ -1461,13 +1464,19 @@ Signatures to be migrated: * Be aware of the existence of the additional result Columns. * New output columns are |generic-result| -* **driving side** parameter is unnamed compulsory, and valid values differ for + +.. note:: Default value of **driving side** parameter + + **driving side** parameter is unnamed, and valid values differ for directed and undirected graphs. - * Does not have a default value. * In directed graph: valid values are [``r``, ``R``, ``l``, ``L``] + + * Default value = 'r'; + * In undirected graph: valid values are [``b``, ``B``] - * Using an invalid value throws an ``ERROR``. + + * Default value = 'b'; ``pgr_withPointsKSP`` (`One to One`) ............................................................................... diff --git a/doc/src/proposed.rst b/doc/src/proposed.rst index 3826bce6d6..69b58bf4be 100644 --- a/doc/src/proposed.rst +++ b/doc/src/proposed.rst @@ -30,12 +30,6 @@ Proposed Functions .. rubric:: Families -:doc:`dijkstra-family` - -.. include:: dijkstra-family.rst - :start-after: proposed-start - :end-before: proposed-end - :doc:`transformation-family` .. include:: transformation-family.rst @@ -68,12 +62,6 @@ Proposed Functions :start-after: proposed-start :end-before: proposed-end -:doc:`via-category` - -.. include:: via-category.rst - :start-after: proposed-start - :end-before: proposed-end - See Also ------------------------------------------------------------------------------- diff --git a/doc/trsp/pgr_trspVia_withPoints.rst b/doc/trsp/pgr_trspVia_withPoints.rst index 80265b7c9f..c8b33dae0b 100644 --- a/doc/trsp/pgr_trspVia_withPoints.rst +++ b/doc/trsp/pgr_trspVia_withPoints.rst @@ -27,7 +27,7 @@ points with restrictions. .. rubric:: Version 4.0.0 * Function promoted to official. -* **Driving side** parameter is positional unnamed and compulsory. +* **Driving side** parameter is positional unnamed. * Valid values depend on kind of graph @@ -85,7 +85,7 @@ One Via .. admonition:: \ \ :class: signatures - | pgr_trspVia_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **via vertices**, **driving side** [**options**]) + | pgr_trspVia_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **via vertices**, [**driving side**,] [**options**]) | **options:** ``[directed, strict, U_turn_on_edge, details]`` | Returns set of |via-result| @@ -101,9 +101,41 @@ One Via Parameters ------------------------------------------------------------------------------- -.. include:: via-category.rst - :start-after: via_withPoints_parameters_start - :end-before: via_withPoints_parameters_end +.. trspvia_withPoints_parameters_start + +.. list-table:: + :width: 81 + :widths: auto + :header-rows: 1 + + * - Parameter + - Type + - Description + * - `Edges SQL`_ + - ``TEXT`` + - SQL query as described. + * - `Restrictions SQL`_ + - ``TEXT`` + - SQL query as described. + * - `Points SQL`_ + - ``TEXT`` + - SQL query as described. + * - **via vertices** + - ``ARRAY`` [ **ANY-INTEGER** ] + - Array of ordered vertices identifiers that are going to be visited. + + * When positive it is considered a vertex identifier + * When negative it is considered a point identifier + +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end + +Where: + +:ANY-INTEGER: SMALLINT, INTEGER, BIGINT + +.. trspvia_withPoints_parameters_end Optional parameters ............................................................................... diff --git a/doc/trsp/pgr_trsp_withPoints.rst b/doc/trsp/pgr_trsp_withPoints.rst index 4bfd9dc157..f4b067bd57 100644 --- a/doc/trsp/pgr_trsp_withPoints.rst +++ b/doc/trsp/pgr_trsp_withPoints.rst @@ -88,12 +88,12 @@ Signatures .. admonition:: \ \ :class: signatures - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vid**, [**options**]) - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vids**, [**options**]) - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vid**, [**options**]) - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vids**, [**options**]) - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Combinations SQL`_, `Points SQL`_, [**options**]) - | **options:** ``[directed, driving_side, details]`` + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vid**, [**driving side**,] [**options**]) + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vids**, [**driving side**,] [**options**]) + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vid**, [**driving side**,] [**options**]) + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vids**, [**driving side**,] [**options**]) + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, `Combinations SQL`_, [**driving side**,] [**options**]) + | **options:** ``[directed, details]`` | Returns set of |short-generic-result| | OR EMPTY SET @@ -107,8 +107,8 @@ One to One .. admonition:: \ \ :class: signatures - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vid**, [**options**]) - | **options:** ``[directed, driving_side, details]`` + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vid**, [**driving side**,] [**options**]) + | **options:** ``[directed, details]`` | Returns set of |short-generic-result| | OR EMPTY SET @@ -129,7 +129,7 @@ One to Many .. admonition:: \ \ :class: signatures - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vids**, **driving side** [**options**]) + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vid**, **end vids**, [**driving side**,] [**options**]) | **options:** ``[directed, details]`` | Returns set of |short-generic-result| @@ -151,8 +151,8 @@ Many to One .. admonition:: \ \ :class: signatures - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vid**, [**options**]) - | **options:** ``[directed, driving_side, details]`` + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vid**, [**driving side**,] [**options**]) + | **options:** ``[directed, details]`` | Returns set of |short-generic-result| | OR EMPTY SET @@ -173,8 +173,8 @@ Many to Many .. admonition:: \ \ :class: signatures - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vids**, [**options**]) - | **options:** ``[directed, driving_side, details]`` + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, **start vids**, **end vids**, [**driving side**,] [**options**]) + | **options:** ``[directed, details]`` | Returns set of |short-generic-result| | OR EMPTY SET @@ -195,8 +195,8 @@ Combinations .. admonition:: \ \ :class: signatures - | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Combinations SQL`_, `Points SQL`_, [**options**]) - | **options:** ``[directed, driving_side, details]`` + | pgr_trsp_withPoints(`Edges SQL`_, `Restrictions SQL`_, `Points SQL`_, `Combinations SQL`_, [**driving side**,] [**options**]) + | **options:** ``[directed, details]`` | Returns set of |short-generic-result| | OR EMPTY SET @@ -214,9 +214,48 @@ From point :math:`1` to vertex :math:`10`, and from vertex :math:`6` to point Parameters ------------------------------------------------------------------------------- -.. include:: pgRouting-concepts.rst - :start-after: restriction_parameters_start - :end-before: restriction_parameters_end +.. restriction_parameters_start + +.. list-table:: + :width: 81 + :widths: 17 22 44 + :header-rows: 1 + + * - Column + - Type + - Description + * - `Edges SQL`_ + - ``TEXT`` + - SQL query as described. + * - `Restrictions SQL`_ + - ``TEXT`` + - SQL query as described. + * - `Points SQL`_ + - ``TEXT`` + - SQL query as described. + * - `Combinations SQL`_ + - ``TEXT`` + - `Combinations SQL`_ as described below + * - **start vid** + - **ANY-INTEGER** + - Identifier of the departure vertex. + * - **start vids** + - ``ARRAY`` [**ANY-INTEGER**] + - Array of identifiers of destination vertices. + * - **end vid** + - **ANY-INTEGER** + - Identifier of the departure vertex. + * - **end vids** + - ``ARRAY`` [**ANY-INTEGER**] + - Array of identifiers of destination vertices. + +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end + +Where: + +:ANY-INTEGER: ``SMALLINT``, ``INTEGER``, ``BIGINT`` Optional parameters ............................................................................... diff --git a/doc/withPoints/pgr_withPoints.rst b/doc/withPoints/pgr_withPoints.rst index a9e59a9910..db0e7d96c4 100644 --- a/doc/withPoints/pgr_withPoints.rst +++ b/doc/withPoints/pgr_withPoints.rst @@ -97,11 +97,11 @@ Signatures .. admonition:: \ \ :class: signatures - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **driving side** [**options**]) - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **driving side** [**options**]) - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **driving side** [**options**]) - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **driving side** [**options**]) - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **driving side** [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, [**driving side**] [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, [**driving side**] [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, [**driving side**] [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, [**driving side**] [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, [**driving side**] [**options**]) | **options:** ``[directed, details])`` | Returns set of |short-generic-result| @@ -116,7 +116,7 @@ One to One .. admonition:: \ \ :class: signatures - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **driving side** [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, [**driving side**] [**options**]) | **options:** ``[directed, details]`` | Returns set of |short-generic-result| @@ -138,7 +138,7 @@ One to Many .. admonition:: \ \ :class: signatures - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **driving side** [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, [**driving side**] [**options**]) | **options:** ``[directed, details]`` | Returns set of |short-generic-result| @@ -160,7 +160,7 @@ Many to One .. admonition:: \ \ :class: signatures - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **driving side** [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, [**driving side**] [**options**]) | **options:** ``[directed, details]`` | Returns set of |short-generic-result| @@ -182,7 +182,7 @@ Many to Many .. admonition:: \ \ :class: signatures - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **driving side** [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, [**driving side**] [**options**]) | **options:** ``[directed, details]`` | Returns set of |short-generic-result| @@ -204,7 +204,7 @@ Combinations .. admonition:: \ \ :class: signatures - | pgr_withPoints(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **driving side** [**options**]) + | pgr_withPoints(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, [**driving side**] [**options**]) | **options:** ``[directed, details]`` | Returns set of |short-generic-result| @@ -227,6 +227,10 @@ Parameters :start-after: withPoints_parameters_start :end-before: withPoints_parameters_end +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end + Optional parameters ............................................................................... diff --git a/doc/withPoints/pgr_withPointsCost.rst b/doc/withPoints/pgr_withPointsCost.rst index 05ac6ff4cb..b52ed2d648 100644 --- a/doc/withPoints/pgr_withPointsCost.rst +++ b/doc/withPoints/pgr_withPointsCost.rst @@ -110,11 +110,11 @@ Signatures .. admonition:: \ \ :class: signatures - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **driving side** [**options**]) - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **driving side** [**options**]) - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **driving side** [**options**]) - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **driving side** [**options**]) - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **driving side** [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, [**driving side**] [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, [**driving side**] [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, [**driving side**] [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, [**driving side**] [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, [**driving side**] [**options**]) | **options:** ``[directed]`` | Returns set of |matrix-result| @@ -132,7 +132,7 @@ One to One .. admonition:: \ \ :class: signatures - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **driving side** [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, [**driving side**] [**options**]) | **options:** ``[directed]`` | Returns set of |matrix-result| @@ -153,7 +153,7 @@ One to Many .. admonition:: \ \ :class: signatures - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **driving side** [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, [**driving side**] [**options**]) | **options:** ``[directed]`` | Returns set of |matrix-result| @@ -175,7 +175,7 @@ Many to One .. admonition:: \ \ :class: signatures - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **driving side** [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, [**driving side**] [**options**]) | **options:** ``[directed]`` | Returns set of |matrix-result| @@ -196,7 +196,7 @@ Many to Many .. admonition:: \ \ :class: signatures - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **driving side** [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, [**driving side**] [**options**]) | **options:** ``[directed]`` | Returns set of |matrix-result| @@ -218,7 +218,7 @@ Combinations .. admonition:: \ \ :class: signatures - | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **driving side** [**options**]) + | pgr_withPointsCost(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, [**driving side**] [**options**]) | **options:** ``[directed]`` | Returns set of |matrix-result| @@ -240,6 +240,10 @@ Parameters :start-after: withPoints_parameters_start :end-before: withPoints_parameters_end +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end + Optional parameters ............................................................................... diff --git a/doc/withPoints/pgr_withPointsCostMatrix.rst b/doc/withPoints/pgr_withPointsCostMatrix.rst index 9834cfc49e..bbeef7424b 100644 --- a/doc/withPoints/pgr_withPointsCostMatrix.rst +++ b/doc/withPoints/pgr_withPointsCostMatrix.rst @@ -59,7 +59,7 @@ Signatures .. admonition:: \ \ :class: signatures - | pgr_withPointsCostMatrix(`Edges SQL`_, `Points SQL`_, **start vids**, **driving side** [**options**]) + | pgr_withPointsCostMatrix(`Edges SQL`_, `Points SQL`_, **start vids**, [**driving side**] [**options**]) | **options:** ``[directed]`` | Returns set of |matrix-result| @@ -73,7 +73,7 @@ Signatures * Returning a **symmetrical** cost matrix * Using the default ``side`` value on the **points_sql** query -* Using the default ``driving_side`` value +* Using the default ``driving side`` value .. literalinclude:: withPointsCostMatrix.queries :start-after: -- q1 @@ -86,6 +86,10 @@ Parameters :start-after: costMatrix_withPoints_parameters_start :end-before: costMatrix_withPoints_parameters_end +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end + Optional parameters ............................................................................... diff --git a/doc/withPoints/pgr_withPointsDD.rst b/doc/withPoints/pgr_withPointsDD.rst index 5816682c2c..968438a548 100644 --- a/doc/withPoints/pgr_withPointsDD.rst +++ b/doc/withPoints/pgr_withPointsDD.rst @@ -70,8 +70,8 @@ Signatures .. admonition:: \ \ :class: signatures - | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vid**, **distance**, **driving side**, [**options A**]) - | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vids**, **distance**, **driving side**, [**options B**]) + | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vid**, **distance**, [**driving side**], [**options A**]) + | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vids**, **distance**, [**driving side**], [**options B**]) | **options A:** ``[directed, details]`` | **options B:** ``[directed, details, equicost]`` @@ -87,7 +87,7 @@ Single vertex .. admonition:: \ \ :class: signatures - | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vid**, **distance**, **driving side**, [**options**]) + | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vid**, **distance**, [**driving side**], [**options**]) | **options:** ``[directed, details]`` | Returns set of |result-spantree| @@ -109,7 +109,7 @@ Multiple vertices .. admonition:: \ \ :class: signatures - | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vids**, **distance**, **driving side**, [**options**]) + | pgr_withPointsDD(`Edges SQL`_, `Points SQL`_, **root vids**, **distance**, [**driving side**], [**options**]) | **options:** ``[directed, details, equicost]`` | Returns set of |result-spantree| @@ -154,18 +154,10 @@ Parameters * - **distance** - ``FLOAT`` - Upper limit for the inclusion of a node in the result. - * - **driving side** - - ``CHAR`` - - - Value in [``r``, ``R``, ``l``, ``L``, ``b``, ``B``] indicating if the driving side is: - - ``r``, ``R`` for right driving side, - - ``l``, ``L`` for left driving side. - - ``b``, ``B`` for both. - - - Valid values differ for directed and undirected graphs: - - - In directed graphs: [``r``, ``R``, ``l``, ``L``]. - - In undirected graphs: [``b``, ``B``]. +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end Where: diff --git a/doc/withPoints/pgr_withPointsKSP.rst b/doc/withPoints/pgr_withPointsKSP.rst index 2c5d6be960..ca68de8543 100644 --- a/doc/withPoints/pgr_withPointsKSP.rst +++ b/doc/withPoints/pgr_withPointsKSP.rst @@ -69,11 +69,11 @@ Signatures .. admonition:: \ \ :class: signatures - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **K**, **driving_side**, [**options**]) - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **K**, **driving_side**, [**options**]) - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **K**, **driving_side**, [**options**]) - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **K**, **driving_side**, [**options**]) - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **K**, **driving_side**, [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **K**, [**driving side**], [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **K**, [**driving side**], [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **K**, [**driving side**], [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **K**, [**driving side**], [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **K**, [**driving side**], [**options**]) | **options:** ``[directed, heap_paths, details]`` | Returns set of |nksp-result| @@ -88,7 +88,7 @@ One to One .. admonition:: \ \ :class: signatures - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **K**, **driving_side**, [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vid**, **K**, [**driving side**], [**options**]) | **options:** ``[directed, heap_paths, details]`` | Returns set of |nksp-result| @@ -114,7 +114,7 @@ One to Many .. admonition:: \ \ :class: signatures - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **K**, **driving_side**, [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vid**, **end vids**, **K**, [**driving side**], [**options**]) | **options:** ``[directed, heap_paths, details]`` | Returns set of |nksp-result| @@ -136,7 +136,7 @@ Many to One .. admonition:: \ \ :class: signatures - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **K**, **driving_side**, [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vid**, **K**, [**driving side**], [**options**]) | **options:** ``[directed, heap_paths, details]`` | Returns set of |nksp-result| @@ -158,7 +158,7 @@ Many to Many .. admonition:: \ \ :class: signatures - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **K**, **driving_side**, [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, **start vids**, **end vids**, **K**, [**driving side**], [**options**]) | **options:** ``[directed, heap_paths, details]`` | Returns set of |nksp-result| @@ -180,7 +180,7 @@ Combinations .. admonition:: \ \ :class: signatures - | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **K**, **driving_side**, [**options**]) + | pgr_withPointsKSP(`Edges SQL`_, `Points SQL`_, `Combinations SQL`_, **K**, [**driving side**], [**options**]) | **options:** ``[directed, heap_paths, details]`` | Returns set of |nksp-result| @@ -231,13 +231,10 @@ Parameters * - **K** - **ANY-INTEGER** - Number of required paths - * - **driving side** - - ``CHAR`` - - Value in [``r``, ``R``, ``l``, ``L``, ``b``, ``B``] indicating if the driving side is: - - [``r``, ``R``] for right driving side (for directed graph only) - - [``l``, ``L``] for left driving side (for directed graph only) - - [``b``, ``B``] for both (only for undirected graph) +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end Where: diff --git a/doc/withPoints/pgr_withPointsVia.rst b/doc/withPoints/pgr_withPointsVia.rst index 1b78228e41..3403720fb1 100644 --- a/doc/withPoints/pgr_withPointsVia.rst +++ b/doc/withPoints/pgr_withPointsVia.rst @@ -74,7 +74,7 @@ One Via .. admonition:: \ \ :class: signatures - | pgr_withPointsVia(`Edges SQL`_, `Points SQL`_, **via vertices**, **driving side** [**options**]) + | pgr_withPointsVia(`Edges SQL`_, `Points SQL`_, **via vertices**, [**driving side**] [**options**]) | **options:** ``[directed, strict, U_turn_on_edge, details]`` | Returns set of |via-result| @@ -90,9 +90,38 @@ One Via Parameters ------------------------------------------------------------------------------- -.. include:: via-category.rst - :start-after: via_withPoints_parameters_start - :end-before: via_withPoints_parameters_end +.. via_withPoints_parameters_start + +.. list-table:: + :width: 81 + :widths: auto + :header-rows: 1 + + * - Parameter + - Type + - Description + * - `Edges SQL`_ + - ``TEXT`` + - SQL query as described. + * - `Points SQL`_ + - ``TEXT`` + - SQL query as described. + * - **via vertices** + - ``ARRAY`` [ **ANY-INTEGER** ] + - Array of ordered vertices identifiers that are going to be visited. + + * When positive it is considered a vertex identifier + * When negative it is considered a point identifier + +.. include:: withPoints-category.rst + :start-after: driving_side_start + :end-before: driving_side_end + +Where: + +:ANY-INTEGER: SMALLINT, INTEGER, BIGINT + +.. via_withPoints_parameters_end Optional parameters ............................................................................... diff --git a/docqueries/trsp/trspVia_withPoints.pg b/docqueries/trsp/trspVia_withPoints.pg index f91371c3c2..21e8bd7db3 100644 --- a/docqueries/trsp/trspVia_withPoints.pg +++ b/docqueries/trsp/trspVia_withPoints.pg @@ -6,7 +6,7 @@ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'R'); + ARRAY[-6, 15, -5]); /* -- q1 */ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, @@ -18,14 +18,15 @@ SELECT agg_cost FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'B', false) -WHERE path_id = 3; + ARRAY[-6, 7, -4, 8, -2] +) +WHERE path_id = 3 AND edge < 0; /* -- q3 */ SELECT route_agg_cost FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + ARRAY[-6, 7, -4, 8, -2]) WHERE path_id = 3 AND edge < 0; /* -- q4 */ SELECT row_number() over () as node_seq, node @@ -33,14 +34,14 @@ FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + ARRAY[-6, 7, -4, 8, -2]) WHERE edge <> -1 ORDER BY seq; /* -- q5 */ SELECT path_id, route_agg_cost FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + ARRAY[-6, 7, -4, 8, -2]) WHERE edge < 0; /* -- q6 */ SELECT seq, node, agg_cost, route_agg_cost, @@ -51,20 +52,20 @@ FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r', details => true) + ARRAY[-6, 7, -4, 8, -2], details => true) WHERE agg_cost <> 0 or seq = 1; /* -- q7 */ SELECT * FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'r'); + ARRAY[-6, 15, -5]); /* -- q8 */ SELECT 1 AS path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost FROM pgr_trsp_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - -6, 15, 'r'); + -6, 15); /* -- q9 */ WITH solutions AS ( @@ -72,7 +73,7 @@ solutions AS ( FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'r') WHERE path_id != 1 + ARRAY[-6, 15, -5]) WHERE path_id != 1 UNION @@ -81,7 +82,7 @@ solutions AS ( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - -6, 15, 'r')), + -6, 15)), with_seq AS ( SELECT row_number() over(ORDER BY path_id, path_seq) AS seq, * FROM solutions), @@ -94,25 +95,25 @@ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'r'); + ARRAY[-6, 15, -5]); /* -- q11 */ SELECT * FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[6, 7, 6], 'r', U_turn_on_edge => false); + ARRAY[6, 7, 6], U_turn_on_edge => false); /* -- q12 */ SELECT 5 AS path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost FROM pgr_trsp_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - 7, 6, 'r'); + 7, 6); /* -- q13 */ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[6, 7, 6], 'r', U_turn_on_edge => false); + ARRAY[6, 7, 6], U_turn_on_edge => false); /* -- q14 */ SELECT * FROM pgr_trspVia_withPoints( $e$ SELECT * FROM edges $e$, @@ -123,5 +124,5 @@ SELECT * FROM pgr_trspVia_withPoints( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - ARRAY[1, -1, -2], 'r', details => true); + ARRAY[1, -1, -2], details => true); /* -- q15 */ diff --git a/docqueries/trsp/trspVia_withPoints.result b/docqueries/trsp/trspVia_withPoints.result index 47a9fa8fb3..7a37d00d48 100644 --- a/docqueries/trsp/trspVia_withPoints.result +++ b/docqueries/trsp/trspVia_withPoints.result @@ -9,7 +9,7 @@ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'R'); + ARRAY[-6, 15, -5]); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | -6 | 15 | -6 | 4 | 0.3 | 0 | 0 @@ -53,23 +53,20 @@ SELECT agg_cost FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'B', false) -WHERE path_id = 3; + ARRAY[-6, 7, -4, 8, -2] +) +WHERE path_id = 3 AND edge < 0; agg_cost ---------- - 0 - 0.7 - 1.7 - 2.3 3.3 -(5 rows) +(1 row) /* -- q3 */ SELECT route_agg_cost FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + ARRAY[-6, 7, -4, 8, -2]) WHERE path_id = 3 AND edge < 0; route_agg_cost ---------------- @@ -82,7 +79,7 @@ FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + ARRAY[-6, 7, -4, 8, -2]) WHERE edge <> -1 ORDER BY seq; node_seq | node ----------+------ @@ -105,7 +102,7 @@ SELECT path_id, route_agg_cost FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + ARRAY[-6, 7, -4, 8, -2]) WHERE edge < 0; path_id | route_agg_cost ---------+---------------- @@ -124,7 +121,7 @@ FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r', details => true) + ARRAY[-6, 7, -4, 8, -2], details => true) WHERE agg_cost <> 0 or seq = 1; seq | node | agg_cost | route_agg_cost | status -----+------+----------+----------------+----------------- @@ -148,7 +145,7 @@ WHERE agg_cost <> 0 or seq = 1; SELECT * FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'r'); + ARRAY[-6, 15, -5]); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | -6 | 15 | -6 | 4 | 0.3 | 0 | 0 @@ -167,7 +164,7 @@ FROM pgr_trsp_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - -6, 15, 'r'); + -6, 15); path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost ---------+----------+-----------+---------+------+------+------+---------- 1 | 1 | -6 | 15 | -6 | 4 | 0.3 | 0 @@ -186,14 +183,14 @@ solutions AS ( FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'r') WHERE path_id != 1 + ARRAY[-6, 15, -5]) WHERE path_id != 1 UNION SELECT 1 AS path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost FROM pgr_trsp_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - -6, 15, 'r')), + -6, 15)), with_seq AS ( SELECT row_number() over(ORDER BY path_id, path_seq) AS seq, * FROM solutions), @@ -219,7 +216,7 @@ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'r'); + ARRAY[-6, 15, -5]); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | -6 | 15 | -6 | 4 | 0.3 | 0 | 0 @@ -238,7 +235,7 @@ SELECT * FROM pgr_trspVia_withPoints( SELECT * FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[6, 7, 6], 'r', U_turn_on_edge => false); + ARRAY[6, 7, 6], U_turn_on_edge => false); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | 6 | 7 | 6 | 4 | 1 | 0 | 0 @@ -257,7 +254,7 @@ FROM pgr_trsp_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - 7, 6, 'r'); + 7, 6); path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost ---------+----------+-----------+---------+------+------+------+---------- 5 | 1 | 7 | 6 | 7 | 4 | 1 | 0 @@ -269,7 +266,7 @@ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, $$SELECT path, cost FROM restrictions$$, $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[6, 7, 6], 'r', U_turn_on_edge => false); + ARRAY[6, 7, 6], U_turn_on_edge => false); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | 6 | 7 | 6 | 4 | 1 | 0 | 0 @@ -288,7 +285,7 @@ SELECT * FROM pgr_trspVia_withPoints( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - ARRAY[1, -1, -2], 'r', details => true); + ARRAY[1, -1, -2], details => true); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | 1 | -1 | 1 | 6 | 1 | 0 | 0 diff --git a/docqueries/trsp/trsp_withPoints.pg b/docqueries/trsp/trsp_withPoints.pg index c4905a606e..00e9eadfb5 100644 --- a/docqueries/trsp/trsp_withPoints.pg +++ b/docqueries/trsp/trsp_withPoints.pg @@ -6,7 +6,7 @@ SELECT * FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT id, path, cost FROM restrictions', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - -1, 10, 'r'); + -1, 10, details => true); /* -- q2 */ SELECT * FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', @@ -18,7 +18,7 @@ SELECT * FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT id, path, cost FROM restrictions', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - ARRAY[-1, 6], -3, 'R'); + ARRAY[-1, 6], -3); /* -- q4 */ SELECT * FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', @@ -45,7 +45,7 @@ SELECT (start_vid || ' -> ' || end_vid ||' at ' || path_seq || 'th step:')::TEXT ELSE ' passes in front of' END as status, CASE WHEN node < 0 THEN 'Point' - ELSE 'Vertex' + ELSE 'Vertex' END as is_a, abs(node) as id FROM pgr_trsp_withPoints( @@ -60,9 +60,9 @@ SELECT (start_vid || ' => ' || end_vid ||' at ' || path_seq || 'th step')::TEXT ELSE ' passes in front of' END as status, CASE WHEN node < 0 THEN 'Point' - ELSE 'Vertex' - END as is_a, - abs(node) as id + ELSE 'Vertex' + END as is_a, + abs(node) as id FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT id, path, cost FROM restrictions', @@ -79,5 +79,5 @@ SELECT * FROM pgr_trsp_withPoints( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - 1, ARRAY[-1, -2], 'B', false); + 1, ARRAY[-1, -2], false); /* -- q10 */ diff --git a/docqueries/trsp/trsp_withPoints.result b/docqueries/trsp/trsp_withPoints.result index 5133460dc6..29bf125dea 100644 --- a/docqueries/trsp/trsp_withPoints.result +++ b/docqueries/trsp/trsp_withPoints.result @@ -9,19 +9,22 @@ SELECT * FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT id, path, cost FROM restrictions', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - -1, 10, 'r'); + -1, 10, details => true); seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost -----+----------+-----------+---------+------+------+------+---------- - 1 | 1 | -1 | 10 | -1 | 1 | 1.4 | 0 - 2 | 2 | -1 | 10 | 6 | 4 | 1 | 1.4 - 3 | 3 | -1 | 10 | 7 | 10 | 1 | 2.4 - 4 | 4 | -1 | 10 | 8 | 12 | 1 | 3.4 - 5 | 5 | -1 | 10 | 12 | 13 | 1 | 4.4 - 6 | 6 | -1 | 10 | 17 | 15 | 1 | 5.4 - 7 | 7 | -1 | 10 | 16 | 16 | 1 | 6.4 - 8 | 8 | -1 | 10 | 15 | 3 | 1 | 7.4 - 9 | 9 | -1 | 10 | 10 | -1 | 0 | 8.4 -(9 rows) + 1 | 1 | -1 | 10 | -1 | 1 | 0.4 | 0 + 2 | 2 | -1 | 10 | 5 | 1 | 1 | 0.4 + 3 | 3 | -1 | 10 | 6 | 4 | 0.7 | 1.4 + 4 | 4 | -1 | 10 | -6 | 4 | 0.3 | 2.1 + 5 | 5 | -1 | 10 | 7 | 10 | 1 | 2.4 + 6 | 6 | -1 | 10 | 8 | 12 | 0.6 | 3.4 + 7 | 7 | -1 | 10 | -3 | 12 | 0.4 | 4 + 8 | 8 | -1 | 10 | 12 | 13 | 1 | 4.4 + 9 | 9 | -1 | 10 | 17 | 15 | 1 | 5.4 + 10 | 10 | -1 | 10 | 16 | 16 | 1 | 6.4 + 11 | 11 | -1 | 10 | 15 | 3 | 1 | 7.4 + 12 | 12 | -1 | 10 | 10 | -1 | 0 | 8.4 +(12 rows) /* -- q2 */ SELECT * FROM pgr_trsp_withPoints( @@ -46,7 +49,7 @@ SELECT * FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT id, path, cost FROM restrictions', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - ARRAY[-1, 6], -3, 'R'); + ARRAY[-1, 6], -3); seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost -----+----------+-----------+---------+------+------+------+---------- 1 | 1 | -1 | -3 | -1 | 1 | 1.4 | 0 @@ -214,7 +217,7 @@ SELECT (start_vid || ' -> ' || end_vid ||' at ' || path_seq || 'th step:')::TEXT ELSE ' passes in front of' END as status, CASE WHEN node < 0 THEN 'Point' - ELSE 'Vertex' + ELSE 'Vertex' END as is_a, abs(node) as id FROM pgr_trsp_withPoints( @@ -243,9 +246,9 @@ SELECT (start_vid || ' => ' || end_vid ||' at ' || path_seq || 'th step')::TEXT ELSE ' passes in front of' END as status, CASE WHEN node < 0 THEN 'Point' - ELSE 'Vertex' - END as is_a, - abs(node) as id + ELSE 'Vertex' + END as is_a, + abs(node) as id FROM pgr_trsp_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT id, path, cost FROM restrictions', @@ -280,7 +283,7 @@ SELECT * FROM pgr_trsp_withPoints( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - 1, ARRAY[-1, -2], 'B', false); + 1, ARRAY[-1, -2], false); seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost -----+----------+-----------+---------+------+------+------+---------- 1 | 1 | 1 | -2 | 1 | 6 | 1 | 0 diff --git a/docqueries/withPoints/withPoints.pg b/docqueries/withPoints/withPoints.pg index 2aabfd441f..2f0c1aa306 100644 --- a/docqueries/withPoints/withPoints.pg +++ b/docqueries/withPoints/withPoints.pg @@ -5,17 +5,17 @@ SET extra_float_digits=-3; SELECT * FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - -1, 10, 'r'); + -1, 10, details => true); /* -- q2 */ SELECT * FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - -1, ARRAY[-3, 7], 'B', directed => false); + -1, ARRAY[-3, 7], directed => false); /* -- q3 */ SELECT * FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - ARRAY[-1, 6], -3, 'R'); + ARRAY[-1, 6], -3); /* -- q4 */ SELECT * FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', @@ -45,7 +45,7 @@ SELECT (start_vid || ' -> ' || end_vid ||' at ' || path_seq || 'th step:')::TEXT FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - ARRAY[5, -1], ARRAY[-6, -3, -6, 10, 11], 'r', details => true) + ARRAY[5, -1], ARRAY[-2, -3, -6, 10, 11], 'r', details => true) WHERE node IN (-6, 11); /* -- q8 */ SELECT (start_vid || ' => ' || end_vid ||' at ' || path_seq || 'th step')::TEXT AS path_at, @@ -70,5 +70,5 @@ SELECT * FROM pgr_withPoints( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - 1, ARRAY[-1, -2], 'B', false); + 1, ARRAY[-1, -2]); /* -- q10 */ diff --git a/docqueries/withPoints/withPoints.result b/docqueries/withPoints/withPoints.result index 465bf25bdb..abf8060e24 100644 --- a/docqueries/withPoints/withPoints.result +++ b/docqueries/withPoints/withPoints.result @@ -8,23 +8,25 @@ SET SELECT * FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - -1, 10, 'r'); + -1, 10, details => true); seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost -----+----------+-----------+---------+------+------+------+---------- - 1 | 1 | -1 | 10 | -1 | 1 | 1.4 | 0 - 2 | 2 | -1 | 10 | 6 | 4 | 1 | 1.4 - 3 | 3 | -1 | 10 | 7 | 8 | 1 | 2.4 - 4 | 4 | -1 | 10 | 11 | 9 | 1 | 3.4 - 5 | 5 | -1 | 10 | 16 | 16 | 1 | 4.4 - 6 | 6 | -1 | 10 | 15 | 3 | 1 | 5.4 - 7 | 7 | -1 | 10 | 10 | -1 | 0 | 6.4 -(7 rows) + 1 | 1 | -1 | 10 | -1 | 1 | 0.4 | 0 + 2 | 2 | -1 | 10 | 5 | 1 | 1 | 0.4 + 3 | 3 | -1 | 10 | 6 | 4 | 0.7 | 1.4 + 4 | 4 | -1 | 10 | -6 | 4 | 0.3 | 2.1 + 5 | 5 | -1 | 10 | 7 | 8 | 1 | 2.4 + 6 | 6 | -1 | 10 | 11 | 9 | 1 | 3.4 + 7 | 7 | -1 | 10 | 16 | 16 | 1 | 4.4 + 8 | 8 | -1 | 10 | 15 | 3 | 1 | 5.4 + 9 | 9 | -1 | 10 | 10 | -1 | 0 | 6.4 +(9 rows) /* -- q2 */ SELECT * FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - -1, ARRAY[-3, 7], 'B', directed => false); + -1, ARRAY[-3, 7], directed => false); seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost -----+----------+-----------+---------+------+------+------+---------- 1 | 1 | -1 | -3 | -1 | 1 | 0.6 | 0 @@ -41,7 +43,7 @@ SELECT * FROM pgr_withPoints( SELECT * FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - ARRAY[-1, 6], -3, 'R'); + ARRAY[-1, 6], -3); seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost -----+----------+-----------+---------+------+------+------+---------- 1 | 1 | -1 | -3 | -1 | 1 | 1.4 | 0 @@ -191,23 +193,27 @@ SELECT (start_vid || ' -> ' || end_vid ||' at ' || path_seq || 'th step:')::TEXT FROM pgr_withPoints( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side FROM pointsOfInterest', - ARRAY[5, -1], ARRAY[-6, -3, -6, 10, 11], 'r', details => true) + ARRAY[5, -1], ARRAY[-2, -3, -6, 10, 11], 'r', details => true) WHERE node IN (-6, 11); path_at | status | is_a | id -----------------------+---------------------+--------+---- -1 -> -6 at 4th step: | visits | Point | 6 -1 -> -3 at 4th step: | passes in front of | Point | 6 + -1 -> -2 at 4th step: | passes in front of | Point | 6 + -1 -> -2 at 6th step: | passes in front of | Vertex | 11 -1 -> 10 at 4th step: | passes in front of | Point | 6 -1 -> 10 at 6th step: | passes in front of | Vertex | 11 -1 -> 11 at 4th step: | passes in front of | Point | 6 -1 -> 11 at 6th step: | visits | Vertex | 11 5 -> -6 at 3th step: | visits | Point | 6 5 -> -3 at 3th step: | passes in front of | Point | 6 + 5 -> -2 at 3th step: | passes in front of | Point | 6 + 5 -> -2 at 5th step: | passes in front of | Vertex | 11 5 -> 10 at 3th step: | passes in front of | Point | 6 5 -> 10 at 5th step: | passes in front of | Vertex | 11 5 -> 11 at 3th step: | passes in front of | Point | 6 5 -> 11 at 5th step: | visits | Vertex | 11 -(12 rows) +(16 rows) /* -- q8 */ SELECT (start_vid || ' => ' || end_vid ||' at ' || path_seq || 'th step')::TEXT AS path_at, @@ -250,7 +256,7 @@ SELECT * FROM pgr_withPoints( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - 1, ARRAY[-1, -2], 'B', false); + 1, ARRAY[-1, -2]); seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost -----+----------+-----------+---------+------+------+------+---------- 1 | 1 | 1 | -2 | 1 | 6 | 1 | 0 @@ -260,9 +266,12 @@ SELECT * FROM pgr_withPoints( 5 | 1 | 1 | -1 | 1 | 6 | 1 | 0 6 | 2 | 1 | -1 | 3 | 7 | 1 | 1 7 | 3 | 1 | -1 | 7 | 8 | 1 | 2 - 8 | 4 | 1 | -1 | 11 | 5 | 0.2 | 3 - 9 | 5 | 1 | -1 | -1 | -1 | 0 | 3.2 -(9 rows) + 8 | 4 | 1 | -1 | 11 | 9 | 1 | 3 + 9 | 5 | 1 | -1 | 16 | 16 | 1 | 4 + 10 | 6 | 1 | -1 | 15 | 3 | 1 | 5 + 11 | 7 | 1 | -1 | 10 | 5 | 0.8 | 6 + 12 | 8 | 1 | -1 | -1 | -1 | 0 | 6.8 +(12 rows) /* -- q10 */ ROLLBACK; diff --git a/docqueries/withPoints/withPointsCost.pg b/docqueries/withPoints/withPointsCost.pg index 81d65f0054..1c029a3ce8 100644 --- a/docqueries/withPoints/withPointsCost.pg +++ b/docqueries/withPoints/withPointsCost.pg @@ -5,18 +5,18 @@ SET extra_float_digits=-3; SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - -1, 10,'r'); + -1, 10); /* -- q2 */ SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - -1, ARRAY[-3, 7], 'B', + -1, ARRAY[-3, 7], directed => false); /* -- q3 */ SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - ARRAY[-1, 6], -3, 'R'); + ARRAY[-1, 6], -3); /* -- q4 */ SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', @@ -44,7 +44,7 @@ SELECT * FROM pgr_withPointsCost( SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - ARRAY[5, -1], ARRAY[-2, -3, -6, 10, 11], 'R'); + ARRAY[5, -1], ARRAY[-2, -3, -6, 10, 11]); /* -- q9 */ SELECT * FROM pgr_withPointsCost( $e$ SELECT * FROM edges $e$, @@ -54,5 +54,5 @@ SELECT * FROM pgr_withPointsCost( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - 1, ARRAY[-1, -2],'B', false); + 1, ARRAY[-1, -2]); /* -- q10 */ diff --git a/docqueries/withPoints/withPointsCost.result b/docqueries/withPoints/withPointsCost.result index 242a1dc3e9..d5f038f2f7 100644 --- a/docqueries/withPoints/withPointsCost.result +++ b/docqueries/withPoints/withPointsCost.result @@ -8,7 +8,7 @@ SET SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - -1, 10,'r'); + -1, 10); start_vid | end_vid | agg_cost -----------+---------+---------- -1 | 10 | 6.4 @@ -18,7 +18,7 @@ SELECT * FROM pgr_withPointsCost( SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - -1, ARRAY[-3, 7], 'B', + -1, ARRAY[-3, 7], directed => false); start_vid | end_vid | agg_cost -----------+---------+---------- @@ -30,7 +30,7 @@ SELECT * FROM pgr_withPointsCost( SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - ARRAY[-1, 6], -3, 'R'); + ARRAY[-1, 6], -3); start_vid | end_vid | agg_cost -----------+---------+---------- -1 | -3 | 4 @@ -106,7 +106,7 @@ SELECT * FROM pgr_withPointsCost( SELECT * FROM pgr_withPointsCost( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', - ARRAY[5, -1], ARRAY[-2, -3, -6, 10, 11], 'R'); + ARRAY[5, -1], ARRAY[-2, -3, -6, 10, 11]); start_vid | end_vid | agg_cost -----------+---------+---------- -1 | -6 | 2.1 @@ -130,11 +130,11 @@ SELECT * FROM pgr_withPointsCost( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - 1, ARRAY[-1, -2],'B', false); + 1, ARRAY[-1, -2]); start_vid | end_vid | agg_cost -----------+---------+---------- 1 | -2 | 2.9 - 1 | -1 | 3.2 + 1 | -1 | 6.8 (2 rows) /* -- q10 */ diff --git a/docqueries/withPoints/withPointsCostMatrix.pg b/docqueries/withPoints/withPointsCostMatrix.pg index 71491a9bc2..c576f355e3 100644 --- a/docqueries/withPoints/withPointsCostMatrix.pg +++ b/docqueries/withPoints/withPointsCostMatrix.pg @@ -5,14 +5,14 @@ SET extra_float_digits=-3; SELECT * FROM pgr_withPointsCostMatrix( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction from pointsOfInterest', - array[-1, 10, 11, -6], 'R'); + array[-1, 10, 11, -6], directed := false); /* -- q2 */ SELECT * FROM pgr_TSP( $$ SELECT * FROM pgr_withPointsCostMatrix( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction from pointsOfInterest', - array[-1, 10, 11, -6], 'b', directed => false); + array[-1, 10, 11, -6], directed => false); $$ ); /* -- q3 */ @@ -24,5 +24,5 @@ SELECT * FROM pgr_withPointsCostMatrix( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - ARRAY[5, 10, -1, -2], 'B', false); + ARRAY[5, 10, -1, -2]); /* -- q4 */ diff --git a/docqueries/withPoints/withPointsCostMatrix.result b/docqueries/withPoints/withPointsCostMatrix.result index 8f19c32c64..3af8aeb9da 100644 --- a/docqueries/withPoints/withPointsCostMatrix.result +++ b/docqueries/withPoints/withPointsCostMatrix.result @@ -8,21 +8,21 @@ SET SELECT * FROM pgr_withPointsCostMatrix( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction from pointsOfInterest', - array[-1, 10, 11, -6], 'R'); + array[-1, 10, 11, -6], directed := false); start_vid | end_vid | agg_cost -----------+---------+---------- -6 | -1 | 1.3 - -6 | 10 | 4.3 + -6 | 10 | 1.7 -6 | 11 | 1.3 -1 | -6 | 1.3 - -1 | 10 | 5.6 + -1 | 10 | 1.6 -1 | 11 | 2.6 10 | -6 | 1.7 10 | -1 | 1.6 10 | 11 | 1 11 | -6 | 1.3 11 | -1 | 2.6 - 11 | 10 | 3 + 11 | 10 | 1 (12 rows) /* -- q2 */ @@ -31,7 +31,7 @@ SELECT * FROM pgr_TSP( SELECT * FROM pgr_withPointsCostMatrix( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction from pointsOfInterest', - array[-1, 10, 11, -6], 'b', directed => false); + array[-1, 10, 11, -6], directed => false); $$ ); seq | node | cost | agg_cost @@ -52,19 +52,19 @@ SELECT * FROM pgr_withPointsCostMatrix( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - ARRAY[5, 10, -1, -2], 'B', false); + ARRAY[5, 10, -1, -2]); start_vid | end_vid | agg_cost -----------+---------+---------- - -2 | -1 | 0.3 - -2 | 5 | 2.9 - -2 | 10 | 1.1 - -1 | -2 | 0.3 - -1 | 5 | 2.8 - -1 | 10 | 0.8 + -2 | -1 | 3.9 + -2 | 5 | 3.1 + -2 | 10 | 3.1 + -1 | -2 | 2.1 + -1 | 5 | 3.2 + -1 | 10 | 3.2 5 | -2 | 2.9 - 5 | -1 | 2.8 - 5 | 10 | 2 - 10 | -2 | 1.1 + 5 | -1 | 6.8 + 5 | 10 | 6 + 10 | -2 | 2.9 10 | -1 | 0.8 10 | 5 | 2 (12 rows) diff --git a/docqueries/withPoints/withPointsVia.pg b/docqueries/withPoints/withPointsVia.pg index 373da590fe..462d1f104b 100644 --- a/docqueries/withPoints/withPointsVia.pg +++ b/docqueries/withPoints/withPointsVia.pg @@ -3,48 +3,48 @@ SET extra_float_digits=-3; /* -- q0 */ SELECT * FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'R'); + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-6, 15, -5]); /* -- q1 */ SELECT * FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'L', directed => true); + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]); /* -- q2 */ SELECT agg_cost FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'B', false) + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE path_id = 3 AND edge < 0; /* -- q3 */ SELECT route_agg_cost FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE path_id = 3 AND edge < 0; /* -- q4 */ SELECT row_number() over () as node_seq, node FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE edge <> -1 ORDER BY seq; /* -- q5 */ SELECT path_id, route_agg_cost FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE edge < 0; /* -- q6 */ SELECT seq, node, -CASE WHEN edge = -1 THEN $$visits$$ -ELSE $$passes in front$$ +CASE WHEN edge = -1 THEN 'visits' +ELSE 'passes in front' END as status FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r', details => true) + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15], details => true) WHERE agg_cost <> 0 or seq = 1; /* -- q7 */ SELECT * FROM pgr_withPointsVia( @@ -55,5 +55,5 @@ SELECT * FROM pgr_withPointsVia( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - ARRAY[1, -1, -2], 'r', details => true); + ARRAY[1, -1, -2], details => true); /* -- q8 */ diff --git a/docqueries/withPoints/withPointsVia.result b/docqueries/withPoints/withPointsVia.result index b1ccd482da..d2ef890157 100644 --- a/docqueries/withPoints/withPointsVia.result +++ b/docqueries/withPoints/withPointsVia.result @@ -6,9 +6,9 @@ SET extra_float_digits=-3; SET /* -- q0 */ SELECT * FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 15, -5], 'R'); + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-6, 15, -5]); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | -6 | 15 | -6 | 4 | 0.3 | 0 | 0 @@ -23,109 +23,105 @@ SELECT * FROM pgr_withPointsVia( /* -- q1 */ SELECT * FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'L', directed => true); + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- - 1 | 1 | 1 | -6 | 7 | -6 | 4 | 0.3 | 0 | 0 - 2 | 1 | 2 | -6 | 7 | 7 | -1 | 0 | 0.3 | 0.3 - 3 | 2 | 1 | 7 | -4 | 7 | 7 | 1 | 0 | 0.3 - 4 | 2 | 2 | 7 | -4 | 3 | 6 | 0.7 | 1 | 1.3 - 5 | 2 | 3 | 7 | -4 | -4 | -1 | 0 | 1.7 | 2 - 6 | 3 | 1 | -4 | 8 | -4 | 6 | 1.3 | 0 | 2 - 7 | 3 | 2 | -4 | 8 | 3 | 7 | 1 | 1.3 | 3.3 - 8 | 3 | 3 | -4 | 8 | 7 | 10 | 1 | 2.3 | 4.3 - 9 | 3 | 4 | -4 | 8 | 8 | -1 | 0 | 3.3 | 5.3 - 10 | 4 | 1 | 8 | -2 | 8 | 12 | 1 | 0 | 5.3 - 11 | 4 | 2 | 8 | -2 | 12 | 13 | 1 | 1 | 6.3 - 12 | 4 | 3 | 8 | -2 | 17 | 15 | 0.6 | 2 | 7.3 - 13 | 4 | 4 | 8 | -2 | -2 | -2 | 0 | 2.6 | 7.9 -(13 rows) + 1 | 1 | 1 | -1 | 7 | -1 | 1 | 1.4 | 0 | 0 + 2 | 1 | 2 | -1 | 7 | 6 | 4 | 1 | 1.4 | 1.4 + 3 | 1 | 3 | -1 | 7 | 7 | -1 | 0 | 2.4 | 2.4 + 4 | 2 | 1 | 7 | -3 | 7 | 10 | 1 | 0 | 2.4 + 5 | 2 | 2 | 7 | -3 | 8 | 12 | 0.6 | 1 | 3.4 + 6 | 2 | 3 | 7 | -3 | -3 | -1 | 0 | 1.6 | 4 + 7 | 3 | 1 | -3 | 16 | -3 | 12 | 0.4 | 0 | 4 + 8 | 3 | 2 | -3 | 16 | 12 | 13 | 1 | 0.4 | 4.4 + 9 | 3 | 3 | -3 | 16 | 17 | 15 | 1 | 1.4 | 5.4 + 10 | 3 | 4 | -3 | 16 | 16 | -1 | 0 | 2.4 | 6.4 + 11 | 4 | 1 | 16 | 15 | 16 | 16 | 1 | 0 | 6.4 + 12 | 4 | 2 | 16 | 15 | 15 | -2 | 0 | 1 | 7.4 +(12 rows) /* -- q2 */ SELECT agg_cost FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'B', false) + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE path_id = 3 AND edge < 0; agg_cost ---------- - 2.7 + 2.4 (1 row) /* -- q3 */ SELECT route_agg_cost FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE path_id = 3 AND edge < 0; route_agg_cost ---------------- - 5.3 + 6.4 (1 row) /* -- q4 */ SELECT row_number() over () as node_seq, node FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE edge <> -1 ORDER BY seq; node_seq | node ----------+------ - 1 | -6 - 2 | 7 - 3 | 3 - 4 | -4 - 5 | 3 - 6 | 7 - 7 | 8 - 8 | 7 - 9 | 11 - 10 | 16 - 11 | -2 -(11 rows) + 1 | -1 + 2 | 6 + 3 | 7 + 4 | 8 + 5 | -3 + 6 | 12 + 7 | 17 + 8 | 16 + 9 | 15 +(9 rows) /* -- q5 */ SELECT path_id, route_agg_cost FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r') + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15]) WHERE edge < 0; path_id | route_agg_cost ---------+---------------- - 1 | 0.3 - 2 | 2.6 - 3 | 5.3 - 4 | 8.7 + 1 | 2.4 + 2 | 4 + 3 | 6.4 + 4 | 7.4 (4 rows) /* -- q6 */ SELECT seq, node, -CASE WHEN edge = -1 THEN $$visits$$ -ELSE $$passes in front$$ +CASE WHEN edge = -1 THEN 'visits' +ELSE 'passes in front' END as status FROM pgr_withPointsVia( - $$SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id$$, - $$SELECT pid, edge_id, side, fraction FROM pointsOfInterest$$, - ARRAY[-6, 7, -4, 8, -2], 'r', details => true) + 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', + 'SELECT pid, edge_id, side, fraction FROM pointsOfInterest', + ARRAY[-1, 7, -3, 16, 15], details => true) WHERE agg_cost <> 0 or seq = 1; seq | node | status -----+------+----------------- - 1 | -6 | passes in front - 2 | 7 | visits - 4 | 3 | passes in front - 5 | 1 | passes in front - 6 | -4 | visits - 8 | 3 | passes in front - 9 | 7 | passes in front - 10 | 8 | visits - 12 | 7 | passes in front - 13 | 11 | passes in front - 14 | 16 | passes in front - 15 | -2 | passes in front -(12 rows) + 1 | -1 | passes in front + 2 | 5 | passes in front + 3 | 6 | passes in front + 4 | -6 | passes in front + 5 | 7 | visits + 7 | 8 | passes in front + 8 | -3 | visits + 10 | 12 | passes in front + 11 | 17 | passes in front + 12 | 16 | visits + 14 | 15 | passes in front +(11 rows) /* -- q7 */ SELECT * FROM pgr_withPointsVia( @@ -136,7 +132,7 @@ SELECT * FROM pgr_withPointsVia( (SELECT ST_POINT(2.9, 1.8)), 0.5, cap => 2) $p$, - ARRAY[1, -1, -2], 'r', details => true); + ARRAY[1, -1, -2], details => true); seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost -----+---------+----------+-----------+---------+------+------+------+----------+---------------- 1 | 1 | 1 | 1 | -1 | 1 | 6 | 1 | 0 | 0 diff --git a/pgtap/dijkstra/dijkstraCostMatrix/types_check.pg b/pgtap/dijkstra/dijkstraCostMatrix/types_check.pg index 29b2d75b41..57a783277f 100644 --- a/pgtap/dijkstra/dijkstraCostMatrix/types_check.pg +++ b/pgtap/dijkstra/dijkstraCostMatrix/types_check.pg @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BEGIN; -SELECT PLAN(5) END; +SELECT PLAN(5); SELECT cost_types_check('pgr_dijkstracostmatrix'); diff --git a/pgtap/ksp/withPointsKSP/no_crash_test.pg b/pgtap/ksp/withPointsKSP/no_crash_test.pg index f58c6bdb4b..cdb2465fd4 100644 --- a/pgtap/ksp/withPointsKSP/no_crash_test.pg +++ b/pgtap/ksp/withPointsKSP/no_crash_test.pg @@ -68,7 +68,7 @@ BEGIN '(SELECT id FROM vertices WHERE id IN (-1))', '(SELECT id FROM vertices WHERE id IN (-1))', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -79,7 +79,7 @@ BEGIN 'NULL::BIGINT', 'NULL::BIGINT', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -97,7 +97,7 @@ BEGIN '(SELECT id FROM vertices WHERE id IN (-1))', '(SELECT array_agg(id) FROM vertices WHERE id IN (-1))', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -108,7 +108,7 @@ BEGIN 'NULL::BIGINT', 'NULL::BIGINT[]', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -126,7 +126,7 @@ BEGIN '(SELECT array_agg(id) FROM vertices WHERE id IN (-1))', '(SELECT id FROM vertices WHERE id IN (-1))', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -137,7 +137,7 @@ BEGIN 'NULL::BIGINT[]', 'NULL::BIGINT', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -154,7 +154,7 @@ BEGIN '(SELECT array_agg(id) FROM vertices WHERE id IN (-1))', '(SELECT array_agg(id) FROM vertices WHERE id IN (-1))', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -165,7 +165,7 @@ BEGIN 'NULL::BIGINT[]', 'NULL::BIGINT[]', 'NULL', - 'NULL' + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -181,8 +181,8 @@ BEGIN 'NULL', 'NULL', '$$(SELECT source, target FROM combinations WHERE source IN (-1))$$', - 'NULL', - 'NULL' + 'NULL::INTEGER', + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); @@ -191,8 +191,8 @@ BEGIN 'NULL', 'NULL', 'NULL::TEXT', - 'NULL', - 'NULL' + 'NULL::INTEGER', + 'NULL::CHAR' ]::TEXT[]; RETURN query SELECT * FROM no_crash_test('pgr_withPointsKSP', params, subs); diff --git a/pgtap/ksp/withPointsKSP/types_check.pg b/pgtap/ksp/withPointsKSP/types_check.pg index a3a29b8486..506c2f3a8c 100644 --- a/pgtap/ksp/withPointsKSP/types_check.pg +++ b/pgtap/ksp/withPointsKSP/types_check.pg @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ BEGIN; -SELECT CASE WHEN min_version('3.6.0') THEN plan(13) ELSE plan(2) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(23) WHEN min_version('3.6.0') THEN plan(11) ELSE plan(2) END; SELECT has_function('pgr_withpointsksp'); @@ -45,38 +45,47 @@ BEGIN IF min_version('4.0.0') THEN + RETURN QUERY SELECT has_function('pgr_withpointsksp',ARRAY['text','text','bigint','bigint','integer','boolean','boolean','boolean']); + RETURN QUERY SELECT has_function('pgr_withpointsksp',ARRAY['text','text','bigint','anyarray','integer','boolean','boolean','boolean']); + RETURN QUERY SELECT has_function('pgr_withpointsksp',ARRAY['text','text','anyarray','bigint','integer','boolean','boolean','boolean']); + RETURN QUERY SELECT has_function('pgr_withpointsksp',ARRAY['text','text','anyarray','anyarray','integer','boolean','boolean','boolean']); + RETURN QUERY SELECT has_function('pgr_withpointsksp',ARRAY['text','text','text','integer','boolean','boolean','boolean']); + + RETURN QUERY SELECT function_returns('pgr_withpointsksp',ARRAY['text','text','bigint','bigint','integer','boolean','boolean','boolean'],'setof record'); + RETURN QUERY SELECT function_returns('pgr_withpointsksp',ARRAY['text','text','bigint','anyarray','integer','boolean','boolean','boolean'],'setof record'); + RETURN QUERY SELECT function_returns('pgr_withpointsksp',ARRAY['text','text','anyarray','bigint','integer','boolean','boolean','boolean'],'setof record'); + RETURN QUERY SELECT function_returns('pgr_withpointsksp',ARRAY['text','text','anyarray','anyarray','integer','boolean','boolean','boolean'],'setof record'); + RETURN QUERY SELECT function_returns('pgr_withpointsksp',ARRAY['text','text','text','integer','boolean','boolean','boolean'],'setof record'); + RETURN QUERY SELECT function_args_eq('pgr_withpointsksp', $$VALUES ('{"","","","","","",directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'::TEXT[]), - ('{"","","","","",directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'::TEXT[]) - $$); + ('{"","","","","","",directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), + ('{"","","","","","",directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), + ('{"","","","","","",directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), + ('{"","","","","", directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), - RETURN QUERY SELECT function_types_eq('pgr_withpointsksp', - $$VALUES - ('{text,text,int8,int8,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,int8,anyarray,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,anyarray,int8,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,anyarray,anyarray,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,text,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]) + ('{"","","","","", directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), + ('{"","","","","", directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), + ('{"","","","","", directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), + ('{"","","","","", directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'), + ('{"","","","", directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}') $$); - ELSE - - RETURN QUERY SELECT function_args_has('pgr_withpointsksp', + RETURN QUERY SELECT function_types_eq('pgr_withpointsksp', $$VALUES - ('{"","","","","","",directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'::TEXT[]), - ('{"","","","","",directed,heap_paths,details,seq,path_id,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'::TEXT[]) - $$); + ('{text,text,int8,int8, int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), + ('{text,text,int8,anyarray, int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), + ('{text,text,anyarray,int8, int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), + ('{text,text,anyarray,anyarray,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), + ('{text,text,text,int4, bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), - RETURN QUERY SELECT function_types_has('pgr_withpointsksp', - $$VALUES - ('{text,text,int8,int8,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,int8,anyarray,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,anyarray,int8,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,anyarray,anyarray,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,text,int4,bpchar,bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]) + ('{text,text,int8,int8, int4, bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), + ('{text,text,int8,anyarray, int4, bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), + ('{text,text,anyarray,int8, int4, bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), + ('{text,text,anyarray,anyarray,int4, bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}'), + ('{text,text,text, int4, bool,bool,bool,int4,int4,int4,int8,int8,int8,int8,float8,float8}') $$); - END IF; END $BODY$ diff --git a/pgtap/trsp/trspVia_withPoints/types_check.pg b/pgtap/trsp/trspVia_withPoints/types_check.pg index fe4571f5da..1d76f8573c 100644 --- a/pgtap/trsp/trspVia_withPoints/types_check.pg +++ b/pgtap/trsp/trspVia_withPoints/types_check.pg @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ BEGIN; -SELECT CASE WHEN min_version('4.0.0') THEN plan(5) ELSE plan(1) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(7) ELSE plan(1) END; SELECT types_check_via('pgr_trspvia_withpoints'); diff --git a/pgtap/trsp/trsp_withpoints/types_check.pg b/pgtap/trsp/trsp_withpoints/types_check.pg index dcb20c2760..883c3f21cc 100644 --- a/pgtap/trsp/trsp_withpoints/types_check.pg +++ b/pgtap/trsp/trsp_withpoints/types_check.pg @@ -20,11 +20,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BEGIN; -SELECT CASE WHEN min_version('4.0.0') THEN plan(13) WHEN min_version('3.4.0') THEN plan(12) ELSE plan(1) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(26) ELSE plan(2) END; SELECT single_path_types_check( 'pgr_trsp_withpoints', '{"",directed,details}'::TEXT[], '{bpchar,bool,bool}'::TEXT[], created_v => '3.4.0', standard_v => '4.0.0'); +SELECT single_path_types_check( + 'pgr_trsp_withpoints', '{directed,details}'::TEXT[], '{bool,bool}'::TEXT[], + created_v => '3.4.0', standard_v => '4.0.0'); + SELECT finish(); ROLLBACK; diff --git a/pgtap/withPoints/withPoints/edge_cases/undirected.pg b/pgtap/withPoints/withPoints/edge_cases/undirected.pg index 1605561268..5a3177983e 100644 --- a/pgtap/withPoints/withPoints/edge_cases/undirected.pg +++ b/pgtap/withPoints/withPoints/edge_cases/undirected.pg @@ -136,7 +136,7 @@ BEGIN -1, 1, 'r', details := false, directed:=false) ORDER BY seq; - RETURN QUERY SELECT throws_ok('q2'); + RETURN QUERY SELECT lives_ok('q2'); -------- left driving side @@ -147,7 +147,7 @@ BEGIN -1, 1, 'l', details := false, directed:=false) ORDER BY seq; - RETURN QUERY SELECT throws_ok('q3'); + RETURN QUERY SELECT lives_ok('q3'); ------------------ ---- FROM 12 to -1 @@ -176,7 +176,7 @@ BEGIN ORDER BY seq; - RETURN QUERY SELECT throws_ok('q5'); + RETURN QUERY SELECT lives_ok('q5'); -------- left driving side @@ -187,7 +187,7 @@ BEGIN 17, -1, 'l', details := false, directed:=false) ORDER BY seq; - RETURN QUERY SELECT throws_ok('q6'); + RETURN QUERY SELECT lives_ok('q6'); ------------------ @@ -216,7 +216,7 @@ BEGIN 5, 1, 'r', details := true, directed:=false) ORDER BY seq; - RETURN QUERY SELECT throws_ok('q8'); + RETURN QUERY SELECT lives_ok('q8'); -------- left driving side @@ -227,7 +227,7 @@ BEGIN 5, 1, 'l', details := true, directed:=false) ORDER BY seq; - RETURN QUERY SELECT throws_ok('q9'); + RETURN QUERY SELECT lives_ok('q9'); ------------------ -- with details @@ -253,7 +253,7 @@ BEGIN 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', 17, -1, 'r', details := true, directed:=false); - RETURN QUERY SELECT throws_ok('q9'); + RETURN QUERY SELECT lives_ok('q9'); -------- left driving side @@ -263,7 +263,7 @@ BEGIN 'SELECT pid, edge_id, fraction, side from pointsOfInterest', 17, -1, 'l', details := true, directed:=false); - RETURN QUERY SELECT throws_ok('q9'); + RETURN QUERY SELECT lives_ok('q9'); END; $BODY$ diff --git a/pgtap/withPoints/withPointsCost/types_check.pg b/pgtap/withPoints/withPointsCost/types_check.pg index 6ef187fdf3..cd6ea41a77 100644 --- a/pgtap/withPoints/withPointsCost/types_check.pg +++ b/pgtap/withPoints/withPointsCost/types_check.pg @@ -19,12 +19,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BEGIN; -SELECT CASE WHEN min_version('4.0.0') THEN plan(13) WHEN min_version('3.2.0') THEN plan(12) ELSE PLAN(10) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(26) ELSE PLAN(4) END; SELECT cost_types_check( 'pgr_withpointscost', '{"",directed}'::TEXT[], '{bpchar,bool}'::TEXT[], standard_v => '4.0.0'); +SELECT cost_types_check( + 'pgr_withpointscost', + '{directed}'::TEXT[], '{bool}'::TEXT[], + standard_v => '4.0.0'); + SELECT finish(); ROLLBACK; diff --git a/pgtap/withPoints/withPointsCostMatrix/types_check.pg b/pgtap/withPoints/withPointsCostMatrix/types_check.pg index c2352df4ad..f45c56db49 100644 --- a/pgtap/withPoints/withPointsCostMatrix/types_check.pg +++ b/pgtap/withPoints/withPointsCostMatrix/types_check.pg @@ -19,12 +19,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ BEGIN; -SELECT CASE WHEN min_version('4.0.0') THEN plan(5) ELSE plan(4) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(10) ELSE plan(4) END; SELECT cost_types_check( 'pgr_withpointscostmatrix', '{"",directed}'::TEXT[], '{bpchar,bool}'::TEXT[], standard_v => '4.0.0'); +SELECT cost_types_check( + 'pgr_withpointscostmatrix', + '{directed}'::TEXT[], '{bool}'::TEXT[], + standard_v => '4.0.0'); + SELECT finish(); ROLLBACK; diff --git a/pgtap/withPoints/withPointsDD/edge_cases/allowed_driving_side.pg b/pgtap/withPoints/withPointsDD/edge_cases/allowed_driving_side.pg index b894ee5c56..d513256578 100644 --- a/pgtap/withPoints/withPointsDD/edge_cases/allowed_driving_side.pg +++ b/pgtap/withPoints/withPointsDD/edge_cases/allowed_driving_side.pg @@ -59,19 +59,19 @@ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( -1, 4.8, 'L', directed => true)$$, 'lives: directed Left'); -- directed b, B -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', -1, 4.8, 'b', directed => true)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: directed both'); + 'lives: directed both'); -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', -1, 4.8, 'B', directed => true)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: directed Both'); + 'lives: directed Both'); -- directed Invalid RETURN QUERY SELECT throws_ok($$ @@ -90,34 +90,34 @@ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( -- undirected lives with b,B throws with and any other value -- undirected r, R -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', -1, 4.8, 'r', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected right'); + 'lives: undirected right'); -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', -1, 4.8, 'R', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected Right'); + 'lives: undirected Right'); -- undirected l, L -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', -1, 4.8, 'l', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected left'); + 'lives: undirected left'); -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', -1, 4.8, 'L', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected Left'); + 'lives: undirected Left'); -- undirected b, B RETURN QUERY SELECT lives_ok($$ @@ -176,19 +176,19 @@ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( ARRAY[-1,9], 4.8, 'L', directed => true)$$, 'lives: directed Left'); -- directed b, B -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', ARRAY[-1,9], 4.8, 'b', directed => true)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: directed both'); + 'lives: directed both'); -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', ARRAY[-1,9], 4.8, 'B', directed => true)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: directed Both'); + 'lives: directed Both'); -- directed Invalid RETURN QUERY SELECT throws_ok($$ @@ -207,34 +207,34 @@ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( -- undirected lives with b,B throws with and any other value -- undirected r, R -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', ARRAY[-1,9], 4.8, 'r', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected right'); + 'lives: undirected right'); -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', ARRAY[-1,9], 4.8, 'R', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected Right'); + 'lives: undirected Right'); -- undirected l, L -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', ARRAY[-1,9], 4.8, 'l', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected left'); + 'lives: undirected left'); -RETURN QUERY SELECT throws_ok($$ +RETURN QUERY SELECT lives_ok($$ SELECT seq, node, edge, cost::TEXT, agg_cost::TEXT FROM pgr_withPointsDD( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id', 'SELECT pid, edge_id, fraction, side from pointsOfInterest', ARRAY[-1,9], 4.8, 'L', directed => false)$$, - 'XX000',$$Invalid value of 'driving side'$$, 'throws: undirected Left'); + 'lives: undirected Left'); -- undirected b, B RETURN QUERY SELECT lives_ok($$ diff --git a/pgtap/withPoints/withPointsVia/types_check.pg b/pgtap/withPoints/withPointsVia/types_check.pg index cd40b55cc7..99b9df90e6 100644 --- a/pgtap/withPoints/withPointsVia/types_check.pg +++ b/pgtap/withPoints/withPointsVia/types_check.pg @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ BEGIN; -SELECT CASE WHEN min_version('4.0.0') THEN plan(5) ELSE plan(1) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(7) ELSE plan(1) END; SELECT types_check_via('pgr_withpointsvia'); diff --git a/sql/driving_distance/withPointsDD.sql b/sql/driving_distance/withPointsDD.sql index 4438c3c2b4..40156df68c 100644 --- a/sql/driving_distance/withPointsDD.sql +++ b/sql/driving_distance/withPointsDD.sql @@ -53,7 +53,8 @@ CREATE FUNCTION pgr_withPointsDD( RETURNS SETOF RECORD AS $BODY$ SELECT seq, depth, start_vid, pred, node, edge, cost, agg_cost - FROM _pgr_withPointsDDv4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4, $5, $6, $7, false); + FROM _pgr_withPointsDDv4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4, + $5, directed, details, false); $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; @@ -82,7 +83,8 @@ CREATE FUNCTION pgr_withPointsDD( RETURNS SETOF RECORD AS $BODY$ SELECT seq, depth, start_vid, pred, node, edge, cost, agg_cost - FROM _pgr_withPointsDDv4(_pgr_get_statement($1), _pgr_get_statement($2), $3, $4, $5, $6, $7, $8); + FROM _pgr_withPointsDDv4(_pgr_get_statement($1), _pgr_get_statement($2), $3, $4, + $5, directed, details, equicost); $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; @@ -95,7 +97,7 @@ IS 'pgr_withPointsDD(Single Vertex) - Points SQL with columns: [pid], edge_id, fraction[,side] - From vertex identifier - Distance - - Driving_side + - Driving side - Optional Parameters - directed := true - details := false @@ -111,7 +113,96 @@ IS 'pgr_withPointsDD(Multiple Vertices) - Points SQL with columns: [pid], edge_id, fraction[,side] - From ARRAY[vertices identifiers] - Distance - - Driving_side + - Driving side +- Optional Parameters + - directed := true + - details := false + - equicost := false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsDD.html +'; + + +-- SINGLE +--v4.0 +CREATE FUNCTION pgr_withPointsDD( + TEXT, --edges_sql (required) + TEXT, -- points_sql (required) + BIGINT, -- from_vid (required) + FLOAT, -- distance (required) + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq BIGINT, + OUT depth BIGINT, + OUT start_vid BIGINT, + OUT pred BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, depth, start_vid, pred, node, edge, cost, agg_cost + FROM _pgr_withPointsDDv4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4, + (CASE WHEN directed THEN 'r' ELSE 'b' END), directed, details, false); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +-- MULTIPLE +--v4.0 +CREATE FUNCTION pgr_withPointsDD( + TEXT, --edges_sql (required) + TEXT, -- points_sql (required) + ANYARRAY, -- from_vid (required) + FLOAT, -- distance (required) + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + equicost BOOLEAN DEFAULT false, + + OUT seq BIGINT, + OUT depth BIGINT, + OUT start_vid BIGINT, + OUT pred BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, depth, start_vid, pred, node, edge, cost, agg_cost + FROM _pgr_withPointsDDv4(_pgr_get_statement($1), _pgr_get_statement($2), $3, $4, + (CASE WHEN directed THEN 'r' ELSE 'b' END), directed, details, equicost); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + + +COMMENT ON FUNCTION pgr_withPointsDD(TEXT, TEXT, BIGINT, FLOAT, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsDD(Single Vertex) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction[,side] + - From vertex identifier + - Distance +- Optional Parameters + - directed := true + - details := false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsDD.html +'; + + +COMMENT ON FUNCTION pgr_withPointsDD(TEXT, TEXT, ANYARRAY, FLOAT, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsDD(Multiple Vertices) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction[,side] + - From ARRAY[vertices identifiers] + - Distance - Optional Parameters - directed := true - details := false diff --git a/sql/ksp/withPointsKSP.sql b/sql/ksp/withPointsKSP.sql index ae117882ef..953284cc4f 100644 --- a/sql/ksp/withPointsKSP.sql +++ b/sql/ksp/withPointsKSP.sql @@ -2,10 +2,10 @@ File: withPointsKSP.sql Copyright (c) 2015 Celia Virginia Vergara Castillo -vicky AT erosion.dev +vicky at erosion.dev Copyright (c) 2023 Abhinav Jain -this.abhinav AT gmail.com +this.abhinav at gmail.com ------ @@ -51,7 +51,8 @@ CREATE FUNCTION pgr_withPointsKSP( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], ARRAY[$4]::BIGINT[], $5, $6, $7, $8, $9); + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], ARRAY[$4]::BIGINT[], $5, $6, + directed, heap_paths, details); $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; @@ -82,7 +83,8 @@ CREATE FUNCTION pgr_withPointsKSP( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4::BIGINT[], $5, $6, $7, $8, $9); + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4::BIGINT[], $5, $6, + directed, heap_paths, details); $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; @@ -113,7 +115,8 @@ CREATE FUNCTION pgr_withPointsKSP( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], ARRAY[$4]::BIGINT[], $5, $6, $7, $8, $9); + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], ARRAY[$4]::BIGINT[], $5, $6, + directed, heap_paths, details); $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; @@ -144,7 +147,8 @@ CREATE FUNCTION pgr_withPointsKSP( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], $4::BIGINT[], $5, $6, $7, $8, $9); + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], $4::BIGINT[], $5, $6, + directed, heap_paths, details); $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; @@ -174,7 +178,8 @@ CREATE FUNCTION pgr_withPointsKSP( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), _pgr_get_statement($3), $4, $5, $6, $7, $8); + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), _pgr_get_statement($3), $4, $5, + directed, heap_paths, details); $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; @@ -258,3 +263,231 @@ IS 'pgr_withPointsKSP - details := false - Documentation: - ${PROJECT_DOC_LINK}/pgr_withPointsKSP.html'; + +-- ONE to ONE +--v4.0 +CREATE FUNCTION pgr_withPointsKSP( + TEXT, -- edges_sql (required) + TEXT, -- points_sql (required) + BIGINT, -- from_vid (required) + BIGINT, -- to_vid (required) + INTEGER, -- K (required) + + directed BOOLEAN DEFAULT true, + heap_paths BOOLEAN DEFAULT false, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_id INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], ARRAY[$4]::BIGINT[], $5, + (CASE WHEN directed THEN 'r' ELSE 'b' END), directed, heap_paths, details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +-- ONE to MANY +--v4.0 +CREATE FUNCTION pgr_withPointsKSP( + TEXT, -- edges_sql (required) + TEXT, -- points_sql (required) + BIGINT, -- from_vid (required) + ANYARRAY,-- to_vids (required) + INTEGER, -- K (required) + + directed BOOLEAN DEFAULT true, + heap_paths BOOLEAN DEFAULT false, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_id INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4::BIGINT[], $5, + (CASE WHEN directed THEN 'r' ELSE 'b' END), directed, heap_paths, details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +-- MANY to ONE +--v4.0 +CREATE FUNCTION pgr_withPointsKSP( + TEXT, -- edges_sql (required) + TEXT, -- points_sql (required) + ANYARRAY,-- from_vid (required) + BIGINT, -- to_vids (required) + INTEGER, -- K (required) + + directed BOOLEAN DEFAULT true, + heap_paths BOOLEAN DEFAULT false, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_id INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], ARRAY[$4]::BIGINT[], $5, + (CASE WHEN directed THEN 'r' ELSE 'b' END), directed, heap_paths, details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +-- MANY to MANY +--v4.0 +CREATE FUNCTION pgr_withPointsKSP( + TEXT, -- edges_sql (required) + TEXT, -- points_sql (required) + ANYARRAY,-- from_vid (required) + ANYARRAY,-- to_vids (required) + INTEGER, -- K (required) + + directed BOOLEAN DEFAULT true, + heap_paths BOOLEAN DEFAULT false, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_id INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], $4::BIGINT[], $5, + (CASE WHEN directed THEN 'r' ELSE 'b' END), directed, heap_paths, details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +-- Combinations SQL signature +--v4.0 +CREATE FUNCTION pgr_withPointsKSP( + TEXT, -- edges_sql (required) + TEXT, -- points_sql (required) + TEXT, -- combinations_sql(required) + INTEGER, -- K (required) + + directed BOOLEAN DEFAULT true, + heap_paths BOOLEAN DEFAULT false, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_id INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPointsKSP_v4(_pgr_get_statement($1), _pgr_get_statement($2), _pgr_get_statement($3), $4, + (CASE WHEN directed THEN 'r' ELSE 'b' END), directed, heap_paths, details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +COMMENT ON FUNCTION pgr_withPointsKSP(TEXT, TEXT, BIGINT, BIGINT, INTEGER, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsKSP +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction[,side] + - From vertex identifier + - To vertex identifier + - K +- Optional Parameters + - directed := true + - heap paths := false + - details := false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsKSP.html'; + +COMMENT ON FUNCTION pgr_withPointsKSP(TEXT, TEXT, BIGINT, ANYARRAY, INTEGER, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsKSP +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction[,side] + - From vertex identifier + - To ARRAY[vertices identifiers] + - K +- Optional Parameters + - directed := true + - heap paths := false + - details := false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsKSP.html'; + +COMMENT ON FUNCTION pgr_withPointsKSP(TEXT, TEXT, ANYARRAY, BIGINT, INTEGER, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsKSP +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction[,side] + - From ARRAY[vertices identifier] + - To vertex identifier + - K +- Optional Parameters + - directed := true + - heap paths := false + - details := false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsKSP.html'; + +COMMENT ON FUNCTION pgr_withPointsKSP(TEXT, TEXT, ANYARRAY, ANYARRAY, INTEGER, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsKSP +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction[,side] + - From ARRAY[vertices identifier] + - To ARRAY[vertices identifiers] + - K +- Optional Parameters + - directed := true + - heap paths := false + - details := false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsKSP.html'; + +COMMENT ON FUNCTION pgr_withPointsKSP(TEXT, TEXT, TEXT, INTEGER, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsKSP +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction[,side] + - Combinations SQL with columns: source, target + - K +- Optional Parameters + - directed := true + - heap paths := false + - details := false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsKSP.html'; diff --git a/sql/sigs/pgrouting--4.0.sig b/sql/sigs/pgrouting--4.0.sig index 90ec9ccaff..2e8a3eb33b 100644 --- a/sql/sigs/pgrouting--4.0.sig +++ b/sql/sigs/pgrouting--4.0.sig @@ -258,12 +258,18 @@ _pgr_trspv4(text,text,anyarray,anyarray,boolean) _pgr_trspv4(text,text,text,boolean) _pgr_trspvia(text,text,anyarray,boolean,boolean,boolean) pgr_trspvia(text,text,anyarray,boolean,boolean,boolean) +pgr_trspvia_withpoints(text,text,text,anyarray,boolean,boolean,boolean,boolean) pgr_trspvia_withpoints(text,text,text,anyarray,character,boolean,boolean,boolean,boolean) _pgr_trspvia_withpoints_v4(text,text,text,anyarray,boolean,boolean,boolean,character,boolean) +pgr_trsp_withpoints(text,text,text,anyarray,anyarray,boolean,boolean) pgr_trsp_withpoints(text,text,text,anyarray,anyarray,character,boolean,boolean) +pgr_trsp_withpoints(text,text,text,anyarray,bigint,boolean,boolean) pgr_trsp_withpoints(text,text,text,anyarray,bigint,character,boolean,boolean) +pgr_trsp_withpoints(text,text,text,bigint,anyarray,boolean,boolean) pgr_trsp_withpoints(text,text,text,bigint,anyarray,character,boolean,boolean) +pgr_trsp_withpoints(text,text,text,bigint,bigint,boolean,boolean) pgr_trsp_withpoints(text,text,text,bigint,bigint,character,boolean,boolean) +pgr_trsp_withpoints(text,text,text,text,boolean,boolean) pgr_trsp_withpoints(text,text,text,text,character,boolean,boolean) _pgr_trsp_withpoints_v4(text,text,text,anyarray,anyarray,boolean,character,boolean) _pgr_trsp_withpoints_v4(text,text,text,text,boolean,character,boolean) @@ -276,30 +282,49 @@ _pgr_turnrestrictedpath_v4(text,text,anyarray,anyarray,integer,boolean,boolean,b pgr_version() _pgr_vrponedepot(text,text,text,integer) pgr_vrponedepot(text,text,text,integer) +pgr_withpointscostmatrix(text,text,anyarray,boolean) pgr_withpointscostmatrix(text,text,anyarray,character,boolean) +pgr_withpointscost(text,text,anyarray,anyarray,boolean) pgr_withpointscost(text,text,anyarray,anyarray,character,boolean) +pgr_withpointscost(text,text,anyarray,bigint,boolean) pgr_withpointscost(text,text,anyarray,bigint,character,boolean) +pgr_withpointscost(text,text,bigint,anyarray,boolean) pgr_withpointscost(text,text,bigint,anyarray,character,boolean) +pgr_withpointscost(text,text,bigint,bigint,boolean) pgr_withpointscost(text,text,bigint,bigint,character,boolean) +pgr_withpointscost(text,text,text,boolean) pgr_withpointscost(text,text,text,character,boolean) +pgr_withpointsdd(text,text,anyarray,double precision,boolean,boolean,boolean) pgr_withpointsdd(text,text,anyarray,double precision,character,boolean,boolean,boolean) +pgr_withpointsdd(text,text,bigint,double precision,boolean,boolean) pgr_withpointsdd(text,text,bigint,double precision,character,boolean,boolean) _pgr_withpointsddv4(text,text,anyarray,double precision,character,boolean,boolean,boolean) +pgr_withpointsksp(text,text,anyarray,anyarray,integer,boolean,boolean,boolean) pgr_withpointsksp(text,text,anyarray,anyarray,integer,character,boolean,boolean,boolean) +pgr_withpointsksp(text,text,anyarray,bigint,integer,boolean,boolean,boolean) pgr_withpointsksp(text,text,anyarray,bigint,integer,character,boolean,boolean,boolean) +pgr_withpointsksp(text,text,bigint,anyarray,integer,boolean,boolean,boolean) pgr_withpointsksp(text,text,bigint,anyarray,integer,character,boolean,boolean,boolean) +pgr_withpointsksp(text,text,bigint,bigint,integer,boolean,boolean,boolean) pgr_withpointsksp(text,text,bigint,bigint,integer,character,boolean,boolean,boolean) +pgr_withpointsksp(text,text,text,integer,boolean,boolean,boolean) pgr_withpointsksp(text,text,text,integer,character,boolean,boolean,boolean) _pgr_withpointsksp_v4(text,text,anyarray,anyarray,integer,character,boolean,boolean,boolean) _pgr_withpointsksp_v4(text,text,text,integer,character,boolean,boolean,boolean) +pgr_withpoints(text,text,anyarray,anyarray,boolean,boolean) _pgr_withpoints(text,text,anyarray,anyarray,boolean,character,boolean,boolean,boolean) pgr_withpoints(text,text,anyarray,anyarray,character,boolean,boolean) +pgr_withpoints(text,text,anyarray,bigint,boolean,boolean) pgr_withpoints(text,text,anyarray,bigint,character,boolean,boolean) +pgr_withpoints(text,text,bigint,anyarray,boolean,boolean) pgr_withpoints(text,text,bigint,anyarray,character,boolean,boolean) +pgr_withpoints(text,text,bigint,bigint,boolean,boolean) pgr_withpoints(text,text,bigint,bigint,character,boolean,boolean) +pgr_withpoints(text,text,text,boolean,boolean) _pgr_withpoints(text,text,text,boolean,character,boolean,boolean) pgr_withpoints(text,text,text,character,boolean,boolean) _pgr_withpoints_v4(text,text,anyarray,anyarray,boolean,character,boolean,boolean,boolean,bigint,boolean) _pgr_withpoints_v4(text,text,text,boolean,character,boolean,boolean,bigint,boolean) +pgr_withpointsvia(text,text,anyarray,boolean,boolean,boolean,boolean) pgr_withpointsvia(text,text,anyarray,character,boolean,boolean,boolean,boolean) _pgr_withpointsvia_v4(text,text,anyarray,boolean,boolean,boolean,character,boolean) diff --git a/sql/trsp/trspVia_withPoints.sql b/sql/trsp/trspVia_withPoints.sql index 5b804878ef..1efd7ff5d8 100644 --- a/sql/trsp/trspVia_withPoints.sql +++ b/sql/trsp/trspVia_withPoints.sql @@ -79,3 +79,55 @@ IS 'pgr_trspVia_withPoints - Documentation: - ${PROJECT_DOC_LINK}/pgr_trspVia_withPoints.html '; + +--v4.0 +CREATE FUNCTION pgr_trspVia_withPoints( + TEXT, -- edges + TEXT, -- restrictions + TEXT, -- points + ANYARRAY, -- via vids + + directed BOOLEAN DEFAULT true, + + -- via parameters + strict BOOLEAN DEFAULT false, + U_turn_on_edge BOOLEAN DEFAULT true, + + -- withPoints parameters + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_id INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT, + OUT route_agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost, route_agg_cost + FROM _pgr_trspVia_withPoints_v4( + _pgr_get_statement($1), _pgr_get_statement($2), _pgr_get_statement($3), $4, + directed, strict, u_turn_on_edge, (CASE WHEN directed THEN 'r' ELSE 'b' END), details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +COMMENT ON FUNCTION pgr_trspVia_withPoints(TEXT, TEXT, TEXT, ANYARRAY, CHAR, BOOLEAN, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_trspVia_withPoints +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Restrictions SQL with columns: cost, path + - Points SQL with columns: [pid], edge_id, fraction [,side] + - ARRAY[via vertices identifiers] +- Optional Parameters + - directed => true + - strict => false + - U_turn_on_edge => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_trspVia_withPoints.html +'; diff --git a/sql/trsp/trsp_withPoints.sql b/sql/trsp/trsp_withPoints.sql index ba1ebd3506..a1cc1f593d 100644 --- a/sql/trsp/trsp_withPoints.sql +++ b/sql/trsp/trsp_withPoints.sql @@ -266,3 +266,233 @@ IS 'pgr_trsp_withPoints(Combinations) - Documentation: - ${PROJECT_DOC_LINK}/pgr_trsp_withPoints.html '; + +--v4.0 +CREATE FUNCTION pgr_trsp_withPoints( + TEXT, -- Edges SQL + TEXT, -- Restrictions SQL + TEXT, -- Points SQL + BIGINT, -- start_vid + BIGINT, -- end_vid + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost +FROM _pgr_trsp_withPoints_v4( + _pgr_get_statement($1), + _pgr_get_statement($2), + _pgr_get_statement($3), + ARRAY[$4]::BIGINT[], ARRAY[$5]::BIGINT[], directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +--v4.0 +CREATE FUNCTION pgr_trsp_withPoints( + TEXT, -- Edges SQL + TEXT, -- Restrictions SQL + TEXT, -- Points SQL + BIGINT, -- start_vid + ANYARRAY, -- end_vids + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost +FROM _pgr_trsp_withPoints_v4( + _pgr_get_statement($1), + _pgr_get_statement($2), + _pgr_get_statement($3), + ARRAY[$4]::BIGINT[], $5::BIGINT[], directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +--v4.0 +CREATE FUNCTION pgr_trsp_withPoints( + TEXT, -- Edges SQL + TEXT, -- Restrictions SQL + TEXT, -- Points SQL + ANYARRAY, -- start_vids + BIGINT, -- end_vid + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost +FROM _pgr_trsp_withPoints_v4( + _pgr_get_statement($1), + _pgr_get_statement($2), + _pgr_get_statement($3), + $4::BIGINT[], ARRAY[$5]::BIGINT[], directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +--v4.0 +CREATE FUNCTION pgr_trsp_withPoints( + TEXT, -- Edges SQL + TEXT, -- Restrictions SQL + TEXT, -- Points SQL + ANYARRAY, -- start_vids + ANYARRAY, -- end_vids + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost +FROM _pgr_trsp_withPoints_v4( + _pgr_get_statement($1), + _pgr_get_statement($2), + _pgr_get_statement($3), + $4::BIGINT[], $5::BIGINT[], directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +--v4.0 +CREATE FUNCTION pgr_trsp_withPoints( + TEXT, -- Edges SQL + TEXT, -- Restrictions SQL + TEXT, -- Points SQL + TEXT, -- combinations SQL + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost +FROM _pgr_trsp_withPoints_v4( + _pgr_get_statement($1), + _pgr_get_statement($2), + _pgr_get_statement($3), + _pgr_get_statement($4), + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +COMMENT ON FUNCTION pgr_trsp_withPoints(TEXT, TEXT, TEXT, BIGINT, BIGINT, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_trsp_withPoints (One to One) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Restrictions SQL with columns: id, cost, path + - Points SQL with columns: [pid], edge_id, fraction [,side] + - Departure vertex/point identifier + - Destination vertex/point identifier +- Optional Parameters: + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_trsp_withPoints.html +'; + + +COMMENT ON FUNCTION pgr_trsp_withPoints(TEXT, TEXT, TEXT, BIGINT, ANYARRAY, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_trsp_withPoints(One to Many) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Restrictions SQL with columns: id, cost, path + - Points SQL with columns: [pid], edge_id, fraction [,side] + - Departure vertex/point identifier + - Destinations ARRAY[vertices/Points identifier] +- Optional Parameters: + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_trsp_withPoints.html +'; + +COMMENT ON FUNCTION pgr_trsp_withPoints(TEXT, TEXT, TEXT, ANYARRAY, BIGINT, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_trsp_withPoints(Many to One) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Restrictions SQL with columns: id, cost, path + - Points SQL with columns: [pid], edge_id, fraction [,side] + - Departures ARRAY[vertices/Points identifier] + - Destination vertex/point identifier +- Optional Parameters: + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_trsp_withPoints.html +'; + +COMMENT ON FUNCTION pgr_trsp_withPoints(TEXT, TEXT, TEXT, ANYARRAY, ANYARRAY, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_trsp_withPoints(Many to Many) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Restrictions SQL with columns: id, cost, path + - Points SQL with columns: [pid], edge_id, fraction [,side] + - Departures ARRAY[vertices/Points identifier] + - Destinations ARRAY[vertices/Points identifier] +- Optional Parameters: + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_trsp_withPoints.html +'; + +COMMENT ON FUNCTION pgr_trsp_withPoints(TEXT, TEXT, TEXT, TEXT, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_trsp_withPoints(Combinations) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Restrictions SQL with columns: id, path, cost + - Points SQL with columns: [pid], edge_id, fraction [,side] + - Combinations SQL with columns: source, target +- Optional Parameters: + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_trsp_withPoints.html +'; diff --git a/sql/withPoints/withPoints.sql b/sql/withPoints/withPoints.sql index 731e9876a7..f70272902f 100644 --- a/sql/withPoints/withPoints.sql +++ b/sql/withPoints/withPoints.sql @@ -178,8 +178,6 @@ $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_HIGH}; - - COMMENT ON FUNCTION pgr_withPoints(TEXT, TEXT, BIGINT, BIGINT, CHAR, BOOLEAN, BOOLEAN) IS 'pgr_withPoints (One to One) - Parameters: @@ -225,7 +223,6 @@ IS 'pgr_withPoints (Many to One) - ${PROJECT_DOC_LINK}/pgr_withPoints.html '; - COMMENT ON FUNCTION pgr_withPoints(TEXT, TEXT, ANYARRAY, ANYARRAY, CHAR, BOOLEAN, BOOLEAN) IS 'pgr_withPoints (Many to Many) - Parameters: @@ -254,3 +251,218 @@ IS 'pgr_withPoints(Combinations) - Documentation: - ${PROJECT_DOC_LINK}/pgr_withPoints.html '; + +--v4.0 +CREATE FUNCTION pgr_withPoints( + TEXT, -- edges + TEXT, -- points + BIGINT, -- start + BIGINT, -- end + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPoints_v4( + _pgr_get_statement($1), _pgr_get_statement($2), + ARRAY[$3]::BIGINT[], ARRAY[$4]::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details, false, true, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + + +--v4.0 +CREATE FUNCTION pgr_withPoints( + TEXT, -- edges + TEXT, -- points + BIGINT, -- start + ANYARRAY, -- ends + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPoints_v4( + _pgr_get_statement($1), _pgr_get_statement($2), + ARRAY[$3]::BIGINT[], $4::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details, false, true, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + + +--v4.0 +CREATE FUNCTION pgr_withPoints( + TEXT, -- edges + TEXT, -- points + ANYARRAY, -- start + BIGINT, -- ends + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPoints_v4( + _pgr_get_statement($1), _pgr_get_statement($2), + $3::BIGINT[], ARRAY[$4]::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details, false, false, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + + +--v4.0 +CREATE FUNCTION pgr_withPoints( + TEXT, -- edges + TEXT, -- points + ANYARRAY, -- start + ANYARRAY, -- ends + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPoints_v4( + _pgr_get_statement($1), _pgr_get_statement($2), + $3::BIGINT[], $4::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details, false, false, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + + +--v4.0 +CREATE FUNCTION pgr_withPoints( + TEXT, -- edges + TEXT, -- points + TEXT, -- combinations + + directed BOOLEAN DEFAULT true, + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_withPoints_v4( + _pgr_get_statement($1), _pgr_get_statement($2), _pgr_get_statement($3), + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), details, false, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +COMMENT ON FUNCTION pgr_withPoints(TEXT, TEXT, BIGINT, BIGINT, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_withPoints (One to One) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From vertex/point identifier + - To vertex/point identifier +- Optional Parameters + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPoints.html +'; + +COMMENT ON FUNCTION pgr_withPoints(TEXT, TEXT, BIGINT, ANYARRAY, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_withPoints (One to Many) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From vertex/point identifier + - To ARRAY[vertices/points identifiers] +- Optional Parameters + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPoints.html +'; + +COMMENT ON FUNCTION pgr_withPoints(TEXT, TEXT, ANYARRAY, BIGINT, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_withPoints (Many to One) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From ARRAY[vertices/points identifiers] + - To vertex/point identifier +- Optional Parameters + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPoints.html +'; + +COMMENT ON FUNCTION pgr_withPoints(TEXT, TEXT, ANYARRAY, ANYARRAY, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_withPoints (Many to Many) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From ARRAY[vertices/points identifiers] + - To ARRAY[vertices/points identifiers] +- Optional Parameters + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPoints.html +'; + +COMMENT ON FUNCTION pgr_withPoints(TEXT, TEXT, TEXT, CHAR, BOOLEAN, BOOLEAN) +IS 'pgr_withPoints(Combinations) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - Combinations SQL with columns: source, target +- Optional Parameters + - directed => true + - details => false +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPoints.html +'; diff --git a/sql/withPoints/withPointsCost.sql b/sql/withPoints/withPointsCost.sql index 6cd5940562..1411c2793c 100644 --- a/sql/withPoints/withPointsCost.sql +++ b/sql/withPoints/withPointsCost.sql @@ -72,7 +72,6 @@ $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_LOW}; - --v4.0 CREATE FUNCTION pgr_withPointsCost( TEXT, -- edges @@ -95,7 +94,6 @@ $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_LOW}; - --v4.0 CREATE FUNCTION pgr_withPointsCost( TEXT, -- edges @@ -118,7 +116,6 @@ $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_LOW}; - --v4.0 CREATE FUNCTION pgr_withPointsCost( TEXT, -- edges @@ -140,7 +137,6 @@ $BODY$ LANGUAGE SQL VOLATILE STRICT COST ${COST_HIGH} ROWS ${ROWS_LOW}; - COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, BIGINT, BIGINT, CHAR, BOOLEAN) IS 'pgr_withPointsCost (One to One) - Parameters: @@ -183,7 +179,6 @@ IS 'pgr_withPointsCost (Many to One) - ${PROJECT_DOC_LINK}/pgr_withPointsCost.html '; - COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, ANYARRAY, ANYARRAY, CHAR, BOOLEAN) IS 'pgr_withPointsCost (Many to Many) - Parameters: @@ -210,3 +205,172 @@ IS 'pgr_withPointsCost(Combinations) - Documentation: - ${PROJECT_DOC_LINK}/pgr_withPointsCost.html '; + +--v4.0 +CREATE FUNCTION pgr_withPointsCost( + TEXT, -- edges + TEXT, -- points + BIGINT, -- starts + BIGINT, -- ends + + directed BOOLEAN DEFAULT true, + + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT start_vid, end_vid, agg_cost +FROM _pgr_withPoints_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], ARRAY[$4]::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), true, true, true, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_LOW}; + + +--v4.0 +CREATE FUNCTION pgr_withPointsCost( + TEXT, -- edges + TEXT, -- points + BIGINT, -- starts + ANYARRAY, -- ends + + directed BOOLEAN DEFAULT true, + + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT start_vid, end_vid, agg_cost +FROM _pgr_withPoints_v4(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), true, true, true, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_LOW}; + +--v4.0 +CREATE FUNCTION pgr_withPointsCost( + TEXT, -- edges + TEXT, -- points + ANYARRAY, -- starts + BIGINT, -- ends + + directed BOOLEAN DEFAULT true, + + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT start_vid, end_vid, agg_cost +FROM _pgr_withPoints_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], ARRAY[$4]::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), true, true, false, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_LOW}; + +--v4.0 +CREATE FUNCTION pgr_withPointsCost( + TEXT, -- edges + TEXT, -- points + ANYARRAY, -- starts + ANYARRAY, -- ends + + directed BOOLEAN DEFAULT true, + + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT agg_cost float) +RETURNS SETOF RECORD AS +$BODY$ +SELECT start_vid, end_vid, agg_cost +FROM _pgr_withPoints_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], $4::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), true, true, true, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_LOW}; + +--v4.0 +CREATE FUNCTION pgr_withPointsCost( + TEXT, -- edges + TEXT, -- points + TEXT, -- combinations + + directed BOOLEAN DEFAULT true, + + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ +SELECT start_vid, end_vid, agg_cost +FROM _pgr_withPoints_v4(_pgr_get_statement($1), _pgr_get_statement($2), _pgr_get_statement($3), + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), true, true, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_LOW}; + +COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, BIGINT, BIGINT, CHAR, BOOLEAN) +IS 'pgr_withPointsCost (One to One) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From vertices/point identifier + - To vertex/point identifier +- Optional Parameters + - directed => true +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsCost.html +'; + +COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, BIGINT, ANYARRAY, CHAR, BOOLEAN) +IS 'pgr_withPointsCost (One to Many) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From vertices/point identifier + - To ARRAY[vertices/points identifiers] +- Optional Parameters + - directed => true +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsCost.html +'; + +COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, ANYARRAY, BIGINT, CHAR, BOOLEAN) +IS 'pgr_withPointsCost (Many to One) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From ARRAY[vertices/points identifiers] + - To vertex/point identifier +- Optional Parameters + - directed => true +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsCost.html +'; + +COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, ANYARRAY, ANYARRAY, CHAR, BOOLEAN) +IS 'pgr_withPointsCost (Many to Many) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - From ARRAY[vertices/points identifiers] + - To ARRAY[vertices/points identifiers] +- Optional Parameters: + - directed => true +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsCost.html +'; + +COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, TEXT, CHAR, BOOLEAN) +IS 'pgr_withPointsCost(Combinations) +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - Combinations SQL with columns: source, target +- Optional Parameters: + - directed => true +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsCost.html +'; diff --git a/sql/withPoints/withPointsCostMatrix.sql b/sql/withPoints/withPointsCostMatrix.sql index b332708ffa..6fd22c9be4 100644 --- a/sql/withPoints/withPointsCostMatrix.sql +++ b/sql/withPoints/withPointsCostMatrix.sql @@ -5,7 +5,7 @@ Copyright (c) 2015 pgRouting developers Mail: project@pgrouting.org Function's developer: -Copyright (c) 2015 Celia Virginia Vergara Castillo +Copyright (c) 2025 Celia Virginia Vergara Castillo Mail: vicky at erosion.dev ------ @@ -59,3 +59,35 @@ IS'pgr_withPointsCostMatrix - Documentation: - ${PROJECT_DOC_LINK}/pgr_withPointsCostMatrix.html '; + +--v4.0 +CREATE FUNCTION pgr_withPointsCostMatrix( + TEXT, -- edges + TEXT, -- points + ANYARRAY, -- vids + + directed BOOLEAN DEFAULT true, + + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT agg_cost float) +RETURNS SETOF RECORD AS +$BODY$ + SELECT start_vid, end_vid, agg_cost + FROM _pgr_withPoints_v4(_pgr_get_statement($1), _pgr_get_statement($2), $3::BIGINT[], '{}'::BIGINT[], + directed, (CASE WHEN directed THEN 'r' ELSE 'b' END), true, true, true, 0, true); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_LOW}; + +COMMENT ON FUNCTION pgr_withPointsCostMatrix(TEXT, TEXT, ANYARRAY, CHAR, BOOLEAN) +IS'pgr_withPointsCostMatrix +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - ARRAY [vertex/points identifiers], +- Optional Parameters: + - directed => true +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_withPointsCostMatrix.html +'; diff --git a/sql/withPoints/withPointsVia.sql b/sql/withPoints/withPointsVia.sql index 0060d84821..fd0ca9ed67 100644 --- a/sql/withPoints/withPointsVia.sql +++ b/sql/withPoints/withPointsVia.sql @@ -78,3 +78,53 @@ IS 'pgr_withPointsVia - Documentation: -{PROJECT_DOC_LINK}/pgr_withPointsVia.html '; + +--v4.0 +CREATE FUNCTION pgr_withPointsVia( + TEXT, -- edges SQL + TEXT, -- points SQL + ANYARRAY, -- via vids + + directed BOOLEAN DEFAULT true, + + -- via parameters + strict BOOLEAN DEFAULT false, + U_turn_on_edge BOOLEAN DEFAULT true, + + -- withPoints parameters + details BOOLEAN DEFAULT false, + + OUT seq INTEGER, + OUT path_id INTEGER, + OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, + OUT node BIGINT, + OUT edge BIGINT, + OUT cost FLOAT, + OUT agg_cost FLOAT, + OUT route_agg_cost FLOAT) +RETURNS SETOF RECORD AS +$BODY$ + SELECT seq, path_id, path_seq, start_vid, end_vid, node, edge, cost, agg_cost, route_agg_cost + FROM _pgr_withPointsVia_v4( + _pgr_get_statement($1), _pgr_get_statement($2), $3, + directed, strict, u_turn_on_edge, (CASE WHEN directed THEN 'r' ELSE 'b' END), details); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH} ROWS ${ROWS_HIGH}; + +COMMENT ON FUNCTION pgr_withPointsVia(TEXT, TEXT, ANYARRAY, CHAR, BOOLEAN, BOOLEAN, BOOLEAN, BOOLEAN) +IS 'pgr_withPointsVia +- Parameters: + - Edges SQL with columns: id, source, target, cost [,reverse_cost] + - Points SQL with columns: [pid], edge_id, fraction [,side] + - ARRAY[via vertices identifiers] +- Optional Parameters + - directed => true + - strict => false + - U_turn_on_edge => true + - details => false +- Documentation: + -{PROJECT_DOC_LINK}/pgr_withPointsVia.html +'; diff --git a/src/cpp_common/to_postgres.cpp b/src/cpp_common/to_postgres.cpp index 566e15c5f9..c692cf3369 100644 --- a/src/cpp_common/to_postgres.cpp +++ b/src/cpp_common/to_postgres.cpp @@ -56,7 +56,7 @@ get_path( e.cost, e.agg_cost, route_agg_cost}; - route_agg_cost += path[path_seq].cost; + route_agg_cost += path[static_cast(path_seq)].cost; path_seq++; ++sequence; } diff --git a/src/dijkstra/shortestPath_driver.cpp b/src/dijkstra/shortestPath_driver.cpp index 702487928c..55aae17559 100644 --- a/src/dijkstra/shortestPath_driver.cpp +++ b/src/dijkstra/shortestPath_driver.cpp @@ -56,7 +56,7 @@ namespace { // TODO(vicky) This should be in its own file char -estimate_drivingSide(char driving_side, bool directed, int32_t which) { +estimate_drivingSide(char driving_side, int32_t which) { char d_side = static_cast(tolower(driving_side)); if (!((d_side == 'r') || (d_side == 'l') || (d_side == 'b'))) { d_side = ' '; @@ -67,12 +67,6 @@ estimate_drivingSide(char driving_side, bool directed, int32_t which) { if (d_side == ' ') { throw std::make_pair(std::string("Invalid value of 'driving side'"), std::string("Valid value are 'r', 'l', 'b'")); - } else if (directed && !(d_side == 'r' || d_side == 'l')) { - throw std::make_pair(std::string("Invalid value of 'driving side'"), - std::string("Valid values for directed graph are: 'r', 'l'")); - } else if (!directed && !(d_side == 'b')) { - throw std::make_pair(std::string("Invalid value of 'driving side'"), - std::string("Valid value for undirected graph is: 'b'")); } } else { /* For the moment its old signature of pgr_withPoints */ @@ -240,7 +234,7 @@ do_shortestPath( */ pgrouting::Pg_points_graph pg_graph(points, edges_of_points, normal, - estimate_drivingSide(driving_side, directed, which), + estimate_drivingSide(driving_side, which), directed); if (pg_graph.has_error()) { diff --git a/src/driving_distance/driving_distance_withPoints.c b/src/driving_distance/driving_distance_withPoints.c index 00af6016ab..af1c05a02b 100644 --- a/src/driving_distance/driving_distance_withPoints.c +++ b/src/driving_distance/driving_distance_withPoints.c @@ -59,12 +59,6 @@ process( if (d_side == ' ') { pgr_throw_error("Invalid value of 'driving side'", "Valid value are 'r', 'l', 'b'"); return; - } else if (directed && !(d_side == 'r' || d_side == 'l')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for directed graph are: 'r', 'l'"); - return; - } else if (!directed && !(d_side == 'b')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for undirected graph is: 'b'"); - return; } if (distance <= 0) { diff --git a/src/ksp/withPoints_ksp.c b/src/ksp/withPoints_ksp.c index 29fa3a6a89..7c13b82a68 100644 --- a/src/ksp/withPoints_ksp.c +++ b/src/ksp/withPoints_ksp.c @@ -67,12 +67,6 @@ process( if (d_side == ' ') { pgr_throw_error("Invalid value of 'driving side'", "Valid value are 'r', 'l', 'b'"); return; - } else if (directed && !(d_side == 'r' || d_side == 'l')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for directed graph are: 'r', 'l'"); - return; - } else if (!directed && !(d_side == 'b')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for undirected graph is: 'b'"); - return; } if (p_k < 0) { diff --git a/src/trsp/trspVia_withPoints.c b/src/trsp/trspVia_withPoints.c index c424fb3a07..8af6e0bb27 100644 --- a/src/trsp/trspVia_withPoints.c +++ b/src/trsp/trspVia_withPoints.c @@ -58,12 +58,6 @@ process( if (d_side == ' ') { pgr_throw_error("Invalid value of 'driving side'", "Valid value are 'r', 'l', 'b'"); return; - } else if (directed && !(d_side == 'r' || d_side == 'l')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for directed graph are: 'r', 'l'"); - return; - } else if (!directed && !(d_side == 'b')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for undirected graph is: 'b'"); - return; } pgr_SPI_connect(); diff --git a/src/trsp/trsp_withPoints.c b/src/trsp/trsp_withPoints.c index a028b418ee..a18e9122ed 100644 --- a/src/trsp/trsp_withPoints.c +++ b/src/trsp/trsp_withPoints.c @@ -61,12 +61,6 @@ process( if (d_side == ' ') { pgr_throw_error("Invalid value of 'driving side'", "Valid value are 'r', 'l', 'b'"); return; - } else if (directed && !(d_side == 'r' || d_side == 'l')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for directed graph are: 'r', 'l'"); - return; - } else if (!directed && !(d_side == 'b')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for undirected graph is: 'b'"); - return; } pgr_SPI_connect(); diff --git a/src/withPoints/withPointsVia.c b/src/withPoints/withPointsVia.c index a7bfd2e1a8..3b8307e12c 100644 --- a/src/withPoints/withPointsVia.c +++ b/src/withPoints/withPointsVia.c @@ -55,12 +55,6 @@ process( if (d_side == ' ') { pgr_throw_error("Invalid value of 'driving side'", "Valid value are 'r', 'l', 'b'"); return; - } else if (directed && !(d_side == 'r' || d_side == 'l')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for directed graph are: 'r', 'l'"); - return; - } else if (!directed && !(d_side == 'b')) { - pgr_throw_error("Invalid value of 'driving side'", "Valid values are for undirected graph is: 'b'"); - return; } pgr_SPI_connect(); diff --git a/tools/testers/general_pgtap_tests.sql b/tools/testers/general_pgtap_tests.sql index 298354e79e..d48bc515e1 100644 --- a/tools/testers/general_pgtap_tests.sql +++ b/tools/testers/general_pgtap_tests.sql @@ -205,15 +205,13 @@ BEGIN query_sql || $$'points_sql', $$ || data || $$, 'L', true)$$, fn || ': Left driving side on directed graph'); - RETURN QUERY SELECT throws_ok( + RETURN QUERY SELECT lives_ok( query_sql || $$'points_sql', $$ || data || $$, 'b')$$, - 'XX000', $$Invalid value of 'driving side'$$, - fn || ': both driving side not allowed on default directed graph'); + fn || ': both driving side allowed on default directed graph'); - RETURN QUERY SELECT throws_ok( + RETURN QUERY SELECT lives_ok( query_sql || $$'points_sql', $$ || data || $$, 'B')$$, - 'XX000', $$Invalid value of 'driving side'$$, - fn || ': Both driving side not allowed on default directed graph'); + fn || ': Both driving side allowed on default directed graph'); RETURN QUERY SELECT throws_ok( query_sql || $$'points_sql', $$ || data || $$, 'w')$$, @@ -239,25 +237,21 @@ BEGIN query_sql || $$'points_sql', $$ || data || $$, 'B', false)$$, fn || ': Both driving side on undirected graph'); - RETURN QUERY SELECT throws_ok( + RETURN QUERY SELECT lives_ok( query_sql || $$'points_sql', $$ || data || $$, 'r', false)$$, - 'XX000', $$Invalid value of 'driving side'$$, - fn || ': right driving side not allowed on undirected graph'); + fn || ': right driving side allowed on undirected graph'); - RETURN QUERY SELECT throws_ok( + RETURN QUERY SELECT lives_ok( query_sql || $$'points_sql', $$ || data || $$, 'R', false)$$, - 'XX000', $$Invalid value of 'driving side'$$, - fn || ': Right driving side not allowed on undirected graph'); + fn || ': Right driving side allowed on undirected graph'); - RETURN QUERY SELECT throws_ok( + RETURN QUERY SELECT lives_ok( query_sql || $$'points_sql', $$ || data || $$, 'l', false)$$, - 'XX000', $$Invalid value of 'driving side'$$, - fn || ': left driving side not allowed on undirected graph'); + fn || ': left driving side allowed on undirected graph'); - RETURN QUERY SELECT throws_ok( + RETURN QUERY SELECT lives_ok( query_sql || $$'points_sql', $$ || data || $$, 'L', false)$$, - 'XX000', $$Invalid value of 'driving side'$$, - fn || ': Left driving side not allowed on undirected graph'); + fn || ': Left driving side allowed on undirected graph'); RETURN QUERY SELECT throws_ok( query_sql || $$'points_sql', $$ || data || $$, 'w', false)$$, diff --git a/tools/testers/types_check.sql b/tools/testers/types_check.sql index b160075367..716fce9e68 100644 --- a/tools/testers/types_check.sql +++ b/tools/testers/types_check.sql @@ -150,9 +150,9 @@ BEGIN extra_name := extra_name || '{""}'::TEXT[]; extra_type := extra_type || '{text}'::TEXT[]; - IF NOT min_version('4.0.0') THEN - opt_names := '{directed,driving_side,details}'::TEXT[]; - opt_types := '{bool,bpchar,bool}'::TEXT[]; + IF NOT min_version(standard_v) THEN + RETURN QUERY SELECT skip(1, fn || ': Standardized on version ' || standard_v); + RETURN; END IF; END IF; @@ -285,6 +285,11 @@ BEGIN RETURN QUERY SELECT has_function(fn); + IF NOT min_version(standard_v) THEN + RETURN QUERY SELECT skip(1, fn || ': Standarized on version ' || standard_v); + RETURN; + END IF; + IF fn ilike '%matrix%' THEN RETURN QUERY SELECT has_function(fn, extra_type || '{text,anyarray}' || taptypes[1:bounds]); @@ -398,6 +403,10 @@ DECLARE return_params_names TEXT[] = ARRAY['seq','path_id','path_seq','start_vid','end_vid','node','edge','cost','agg_cost','route_agg_cost']; return_params_types TEXT[] = '{int4,int4,int4,int8,int8,int8,int8,float8,float8,float8}'::TEXT[]; + ds_params_names TEXT[]; + ds_params_types_words TEXT[]; + ds_params_types TEXT[]; + names TEXT; typs TEXT; BEGIN @@ -437,9 +446,12 @@ BEGIN IF fn LIKE '%withpoints%' THEN -- driving side - params_names := params_names || ARRAY['']; - params_types_words := params_types_words || 'character'::TEXT; - params_types := params_types || 'bpchar'::TEXT; + ds_params_names := params_names || ARRAY['']; + ds_params_types_words := params_types_words || 'character'::TEXT; + ds_params_types := params_types || 'bpchar'::TEXT; + + RETURN QUERY SELECT has_function(fn, ds_params_types_words || optional_params_types_words); + RETURN QUERY SELECT function_returns(fn, ds_params_types_words || optional_params_types_words,'setof record'); END IF; RETURN QUERY SELECT has_function(fn); @@ -447,23 +459,36 @@ BEGIN RETURN QUERY SELECT function_returns(fn, params_types_words || optional_params_types_words,'setof record'); - RETURN QUERY SELECT function_args_eq(fn, - format( - $$VALUES (%1$L::TEXT[])$$, - -- one via - '{"' || array_to_string( - params_names || optional_params_names || return_params_names,'","') - || '"}')); + IF fn LIKE '%withpoints%' THEN + + RETURN QUERY SELECT function_args_eq(fn, + format($$VALUES ('%1$s'::TEXT[]), ('%2$s') $$, + params_names || optional_params_names || return_params_names, + ds_params_names || optional_params_names || return_params_names + )); - RETURN QUERY SELECT function_types_eq(fn, - format( - $$VALUES (%1$L::TEXT[])$$, - -- one via - '{"' || array_to_string( - params_types || optional_params_types || return_params_types,'","') - || '"}')); + RETURN QUERY SELECT function_types_eq(fn, + format($$VALUES ('%1$s'::TEXT[]), ('%2$s') $$, + params_types || optional_params_types || return_params_types, + ds_params_types || optional_params_types || return_params_types + )); -END; -$BODY$ -LANGUAGE plpgsql; + ELSE + + RETURN QUERY SELECT function_args_eq(fn, + format($$VALUES ('%1$s'::TEXT[]) $$, + params_names || optional_params_names || return_params_names + )); + + RETURN QUERY SELECT function_types_eq(fn, + format($$VALUES ('%1$s'::TEXT[]) $$, + params_types || optional_params_types || return_params_types + )); + + END IF; + + + END; + $BODY$ + LANGUAGE plpgsql;