Skip to content

Issue tbd wrap pg proc test functions #2805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

cvvergara
Copy link
Member

@cvvergara cvvergara commented Mar 31, 2025

Demo

@pgRouting/admins

Summary by CodeRabbit

  • Tests & Refactor
    • Improved the validation of function signatures in our test suite by switching from numeric type identifiers to descriptive, human-readable type names.
    • Streamlined internal type-checking routines for better consistency and clearer error reporting.
    • Enhanced overall reliability and maintainability of the testing processes, contributing to more robust performance.

Copy link
Contributor

coderabbitai bot commented Mar 31, 2025

Walkthrough

This update refactors multiple SQL test scripts in the pgRouting pgtap suite. All changes replace legacy OID‐based function argument type checks (using queries with set_eq and set_has) with direct calls to a dedicated function, function_types_eq. Expected argument types are now defined as human‐readable TEXT arrays (e.g., text, int8, etc.) instead of numeric OID arrays. New scripts have also been added for topological sort testing, while tester scripts have been updated accordingly.

Changes

Files Change Summary
pgtap/allpairs/*/types_check.pg, pgtap/alpha_shape/types_check.pg, pgtap/bdDijkstra/*/types_check.pg, pgtap/bellman_ford/*/types_check.pg, pgtap/chinese/*/types_check.pg, pgtap/circuits/hawickCircuits/types_check.pg, pgtap/coloring/*/types_check.pg, pgtap/components/*/types_check.pg, pgtap/contraction/*/types_check.pg, pgtap/dijkstra/*/types_check.pg, pgtap/dominators/*/types_check.pg, pgtap/ksp/*/types_check.pg, pgtap/lineGraph/*/types_check.pg, pgtap/max_flow/*/types_check.pg, pgtap/metrics/*/types_check.pg, pgtap/mincut/*/types_check.pg, pgtap/ordering/*/types_check.pg, pgtap/pickDeliver/*/types_check.pg, pgtap/topology/*/types_check.pg, pgtap/traversal/*/types_check.pg, pgtap/trsp/*/types_check.pg, pgtap/withPoints/*/types_check.pg Replaced legacy OID-based type validations (using set_eq/set_has and subqueries of pg_proc) with direct calls to function_types_eq, now expressing expected types as descriptive TEXT arrays.
pgtap/ordering/topologicalSort/* Added new SQL scripts (inner_query.pg, no_crash_test.pg, types_check.pg) to test and validate the pgr_topologicalsort function with updated logic and rollback handling.
tools/testers/*.sql (e.g. astar_pgtap_tests.sql, dijkstra_pgtap_tests.sql, flow_pgtap_tests.sql, general_pgtap_tests.sql, spanningtree.sql, tsp_pgtap_tests.sql) Updated tester scripts across the suite to replace OID-array type comparisons with function_types_eq calls. Renamed and improved helper functions for clarity by using human-readable text-based type definitions.

Sequence Diagram(s)

sequenceDiagram
    participant TS as Test Script
    participant FT as function_types_eq
    participant PG as pg_proc Catalog
    TS->>FT: Call function_types_eq(fn, expectedTypes)
    FT->>PG: Query function signature (proallargtypes)
    PG-->>FT: Return actual type array
    FT-->>TS: Compare actual vs expected (TEXT arrays)
Loading

Possibly related PRs

Poem

In the fields of code I roam with glee,
No more numbers—text shines clear to see.
OIDs hop away, replaced by names so bright,
Function types now gleam in a pure, clean light.
With function_types_eq as my guide each day,
I, a happy rabbit, hop along the way. 🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cvvergara cvvergara marked this pull request as draft March 31, 2025 16:11
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d31e790 and f5914f9.

📒 Files selected for processing (74)
  • pgtap/allpairs/floydWarshall/types_check.pg (1 hunks)
  • pgtap/allpairs/johnson/types_check.pg (1 hunks)
  • pgtap/alpha_shape/types_check.pg (1 hunks)
  • pgtap/bdDijkstra/bdDijkstraCost/types_check.pg (2 hunks)
  • pgtap/bdDijkstra/bdDijkstraCostMatrix/types_check.pg (1 hunks)
  • pgtap/bellman_ford/bellman_ford/types_check.pg (2 hunks)
  • pgtap/bellman_ford/edwardMoore/types_check.pg (2 hunks)
  • pgtap/chinese/chinesePostman/types_check.pg (1 hunks)
  • pgtap/chinese/chinesePostmanCost/types_check.pg (1 hunks)
  • pgtap/circuits/hawickCircuits/types_check.pg (1 hunks)
  • pgtap/coloring/bipartite/types_check.pg (1 hunks)
  • pgtap/coloring/edgeColoring/types_check.pg (1 hunks)
  • pgtap/coloring/sequentialVertexColoring/types_check.pg (1 hunks)
  • pgtap/components/articulationPoints/types_check.pg (1 hunks)
  • pgtap/components/biconnectedComponents/types_check.pg (1 hunks)
  • pgtap/components/bridges/types_check.pg (1 hunks)
  • pgtap/components/connectedComponenes/types_check.pg (1 hunks)
  • pgtap/components/makeConnected/types_check.pg (1 hunks)
  • pgtap/components/strongComponenets/types_check.pg (1 hunks)
  • pgtap/contraction/contraction/types_check.pg (2 hunks)
  • pgtap/contraction/contractionDeadEnd/types_check.pg (1 hunks)
  • pgtap/contraction/contractionLinear/types_check.pg (1 hunks)
  • pgtap/dijkstra/dijkstraCost/types_check.pg (2 hunks)
  • pgtap/dijkstra/dijkstraCostMatrix/types_check.pg (1 hunks)
  • pgtap/dijkstra/dijkstraNear/types_check.pg (1 hunks)
  • pgtap/dijkstra/dijkstraNearCost/types_check.pg (1 hunks)
  • pgtap/dijkstra/driving_distance/types_check.pg (2 hunks)
  • pgtap/dominator/lengauerTarjanDominatorTree/types_check.pg (1 hunks)
  • pgtap/ksp/ksp/types_check.pg (2 hunks)
  • pgtap/ksp/turnRestrictedPath/types_check.pg (1 hunks)
  • pgtap/ksp/withPointsKSP/types_check.pg (1 hunks)
  • pgtap/lineGraph/lineGraph/types_check.pg (1 hunks)
  • pgtap/lineGraph/lineGraphFull/types_check.pg (1 hunks)
  • pgtap/max_flow/edgedisjointpaths/types_check.pg (2 hunks)
  • pgtap/max_flow/maxCardinalityMatch/types_check.pg (2 hunks)
  • pgtap/max_flow/maxFlow/types_check.pg (2 hunks)
  • pgtap/max_flow/maxFlowMinCost/types_check.pg (2 hunks)
  • pgtap/max_flow/maxFlowMinCost_Cost/types_check.pg (2 hunks)
  • pgtap/metrics/betweennessCentrality/types_check.pg (1 hunks)
  • pgtap/metrics/degree/types_check.pg (1 hunks)
  • pgtap/mincut/stoerWagner/types_check.pg (1 hunks)
  • pgtap/ordering/cuthillMckeeOrdering/types_check.pg (1 hunks)
  • pgtap/ordering/topologicalSort/inner_query.pg (1 hunks)
  • pgtap/ordering/topologicalSort/no_crash_test.pg (1 hunks)
  • pgtap/ordering/topologicalSort/types_check.pg (1 hunks)
  • pgtap/pickDeliver/pickDeliver/types_check.pg (1 hunks)
  • pgtap/pickDeliver/pickDeliverEuclidean/types_check.pg (1 hunks)
  • pgtap/topology/analyzeGraph/types_check.pg (1 hunks)
  • pgtap/topology/analyzeOneWay/types_check.pg (1 hunks)
  • pgtap/topology/createTopology/types_check.pg (1 hunks)
  • pgtap/topology/createVerticesTable/types_check.pg (1 hunks)
  • pgtap/topology/extractVertices/types_check.pg (1 hunks)
  • pgtap/topology/nodeNetwork/types_check.pg (1 hunks)
  • pgtap/transitiveClosure/types_check.pg (1 hunks)
  • pgtap/traversal/binaryBreadthFirstSearch/types_check.pg (2 hunks)
  • pgtap/traversal/breadthFirstSearch/types_check.pg (1 hunks)
  • pgtap/traversal/depthFirstSearch/types_check.pg (1 hunks)
  • pgtap/trsp/trsp/types_check.pg (1 hunks)
  • pgtap/trsp/trspViaEdges/types_check.pg (1 hunks)
  • pgtap/trsp/trspViaVertices/types_check.pg (1 hunks)
  • pgtap/utilities/findCloseEdges/types_check.pg (2 hunks)
  • pgtap/version/full_version/types_check.pg (1 hunks)
  • pgtap/version/version/types_check.pg (1 hunks)
  • pgtap/vrp_basic/types_check.pg (1 hunks)
  • pgtap/withPoints/withPoints/types_check.pg (2 hunks)
  • pgtap/withPoints/withPointsCost/types_check.pg (2 hunks)
  • pgtap/withPoints/withPointsCostMatrix/types_check.pg (1 hunks)
  • pgtap/withPoints/withPointsDD/types_check.pg (2 hunks)
  • tools/testers/astar_pgtap_tests.sql (9 hunks)
  • tools/testers/dijkstra_pgtap_tests.sql (3 hunks)
  • tools/testers/flow_pgtap_tests.sql (2 hunks)
  • tools/testers/general_pgtap_tests.sql (1 hunks)
  • tools/testers/spanningtree.sql (5 hunks)
  • tools/testers/tsp_pgtap_tests.sql (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (15)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Ubuntu Boost (86)
  • GitHub Check: Ubuntu Boost (79)
  • GitHub Check: Ubuntu Boost (56)
  • GitHub Check: Ubuntu Boost (84)
  • GitHub Check: Ubuntu Boost (75)
  • GitHub Check: Ubuntu Boost (83)
  • GitHub Check: Ubuntu Boost (77)
  • GitHub Check: Ubuntu Boost (76)
  • GitHub Check: Ubuntu Boost (80)
  • GitHub Check: Ubuntu Boost (78)
  • GitHub Check: Ubuntu Boost (68)
  • GitHub Check: macos (macos-14)
  • GitHub Check: macos (macos-latest)
  • GitHub Check: Ubuntu clang
🔇 Additional comments (104)
pgtap/allpairs/floydWarshall/types_check.pg (1)

34-37: Improved type checking with better readability

The change replaces OID-based argument type checking with the function_types_eq function and human-readable type names. This improves readability and maintainability by using explicit type names (text,bool,int8,int8,float8) instead of numeric OIDs.

pgtap/dijkstra/dijkstraCostMatrix/types_check.pg (1)

34-37: Improved type checking mechanism

The change replaces the previous OID-based type checking with the more readable function_types_eq function. Using explicit type names (text,anyarray,bool,int8,int8,float8) instead of numeric OIDs makes the test more maintainable and easier to understand.

pgtap/ordering/topologicalSort/inner_query.pg (1)

1-29: Well-structured new test file for topological sort

This new test file follows the project's conventions with proper licensing, transaction management, and test structure. The file sets up the test environment by modifying edge costs and executing the topological sort function through the style_dijkstra helper.

pgtap/chinese/chinesePostmanCost/types_check.pg (1)

39-41: Enhanced type checking with better readability

The change replaces the previous OID-based type checking with the more explicit function_types_eq function. Using a text array ({text}) for type specification improves readability and maintainability compared to numeric OIDs.

pgtap/version/full_version/types_check.pg (1)

37-38: Well-structured type check refactoring

The change from using set_eq with OID-based parameter types to using function_types_eq with human-readable text types is a good improvement. This makes the test more readable and maintainable since it's now immediately clear that pgr_full_version expects 9 text parameters without having to interpret numeric OID values.

pgtap/allpairs/johnson/types_check.pg (1)

34-36: Improved type checking clarity

Nice replacement of OID-based type checking with human-readable type names. The new approach using function_types_eq with explicit type names (text, bool, int8, int8, float8) is much more readable and maintainable than using numeric OIDs.

pgtap/version/version/types_check.pg (1)

24-24:

❓ Verification inconclusive

Verify test reduction is intentional

The number of planned tests has been reduced from 6 to 3, which suggests that some tests have been removed entirely rather than refactored like in the other files. Could you clarify why the tests for argument names, argument types, and return type have been removed instead of being updated to use function_types_eq?


🏁 Script executed:

#!/bin/bash
# Check what tests were removed from this file by looking at git history
git show HEAD~1:pgtap/version/version/types_check.pg | grep -A 10 "SELECT plan"

Length of output: 281


Action: Please Confirm If Test Reduction in types_check.pg Is Intentional

It looks like the file now only plans for three tests, and based on the git history from HEAD~1, tests checking for function existence and the return type remain while any explicit tests for argument names and argument types are no longer present. Could you clarify whether this removal was deliberate—that is, if these checks are now being handled by a consolidated approach (e.g., via function_types_eq)—or if additional tests are meant to be added?

  • Previously (HEAD~1), the file ran checks for existence and return type.
  • The planned test count now reflects only 3 tests, with no separate checks for argument names/types.
  • Please confirm if this change aligns with the refactoring strategy in other files.
pgtap/components/articulationPoints/types_check.pg (1)

34-35: Good migration to readable type checks

This change effectively moves from OID-based type checking to using function_types_eq with human-readable type names (text, int8). This approach aligns with the changes in other files and improves code readability and maintainability.

pgtap/pickDeliver/pickDeliverEuclidean/types_check.pg (1)

37-40: Improved type checking with human-readable format

This change replaces the previous OID-based type check with a more readable text representation of argument types. The function_types_eq function provides a clearer way to validate the argument types for pgr_pickdelivereuclidean, which should make maintenance easier.

pgtap/lineGraph/lineGraphFull/types_check.pg (1)

33-34: Enhanced readability with text-based type checking

Converting from OID-based type checking (set_eq) to the more explicit function_types_eq with human-readable type names (text, int4, int8, etc.) improves code clarity and maintainability. This change aligns with the standardization across the codebase.

pgtap/components/connectedComponenes/types_check.pg (1)

33-34: Standardized type checking approach

Good refactoring from OID-based type checking to text-based checking with function_types_eq. This makes the expected argument types for pgr_connectedcomponents more readable and follows the consistent pattern being applied across the test suite.

pgtap/components/bridges/types_check.pg (1)

34-35: Consistent approach to type validation

The change to function_types_eq with readable type names (text, int8) improves code clarity over the previous OID-based comparison. This follows the same pattern as other files in this update and helps standardize the testing approach.

pgtap/pickDeliver/pickDeliver/types_check.pg (1)

36-39: Improved type checking for pgr_pickdeliver function

This change replaces the old OID-based type checking with the more readable function_types_eq approach. Using text representations of types (text, float8, int4, etc.) instead of numeric OIDs significantly improves readability and maintainability of the test code.

pgtap/components/makeConnected/types_check.pg (1)

45-47: Better type validation for pgr_makeconnected

Good refactoring from OID-based type checking to human-readable type names using function_types_eq. The change maintains the same functionality while making the test more maintainable and easier to understand. The array format '{text,int8,int8,int8}' clearly communicates the expected argument types.

pgtap/lineGraph/lineGraph/types_check.pg (1)

33-34: Improved type checking clarity for pgr_linegraph

This change follows the same pattern as the other files, replacing OID-based type checking with the more readable and maintainable function_types_eq approach. The TEXT array of types is much easier to understand than numeric OIDs.

pgtap/vrp_basic/types_check.pg (1)

32-33: Enhanced type validation for pgr_vrponedepot

This change completes the consistent pattern of refactoring across the test suite. The transition from OID-based type checking to using function_types_eq with readable type names improves code clarity and maintainability.

pgtap/coloring/sequentialVertexColoring/types_check.pg (1)

46-48: Improved type checking readability with function_types_eq

The change from using set_eq with OID-based type checks to function_types_eq with human-readable type names is a good improvement. Using {text,int8,int8} instead of OIDs makes the test more maintainable and easier to understand.

pgtap/coloring/bipartite/types_check.pg (1)

46-48: Improved type checking readability with function_types_eq

Good improvement replacing the OID-based type checks with human-readable type names ({text,int8,int8}). This approach is more maintainable and consistent with the pattern being applied across the codebase.

pgtap/topology/createVerticesTable/types_check.pg (1)

33-35: Enhanced type checking with function_types_eq

The change to use function_types_eq with human-readable type names ({text,text,text,text,text}) is a good improvement for maintainability. This brings consistency with the type checking pattern applied across other test files.

pgtap/contraction/contractionDeadEnd/types_check.pg (1)

43-44: Function call standardized to function_types_eq

Good change standardizing on function_types_eq for type checking. This creates consistency across the test suite while maintaining the already human-readable type specifications.

pgtap/topology/analyzeOneWay/types_check.pg (1)

33-34: Improved type checking approach

The code now uses function_types_eq instead of direct OID comparisons for checking function parameter types. This change enhances readability by using human-readable type names (like 'text', 'bool') instead of numeric OIDs.

pgtap/topology/createTopology/types_check.pg (1)

33-34: Enhanced readability with function_types_eq

The change replaces a direct OID comparison with the more readable function_types_eq function. This makes the test more maintainable by using text-based type names ('text', 'float8', 'bool') rather than numeric OIDs.

pgtap/max_flow/maxFlow/types_check.pg (3)

23-23: Updated test count

The plan count has been reduced from 14 to 13 tests. Make sure this aligns with the actual number of tests being executed in the script.


54-61: Improved type checking for version 3.2.0+

The code now uses function_types_eq with human-readable type names instead of OID arrays. This change makes the tests more readable and maintainable, clearly showing the expected function signatures.


65-71: Enhanced type checking for older versions

Similar to the 3.2.0+ version, this section now uses function_types_eq with readable type names for older PostgreSQL versions. Consistent approach across version-specific code paths.

pgtap/withPoints/withPointsCostMatrix/types_check.pg (1)

34-36: Improved parameter type checking

The test now uses function_types_eq with a TEXT array of human-readable type names instead of numeric OIDs. This makes the test more intuitive and easier to maintain.

pgtap/mincut/stoerWagner/types_check.pg (1)

36-39: Good refactoring to improve readability and maintainability

The change from using a direct query against pg_proc to using function_types_eq makes the code more maintainable. The new approach with human-readable TEXT arrays (e.g., 'text', 'int4', etc.) instead of OID values is much easier to understand and maintain.

pgtap/ksp/turnRestrictedPath/types_check.pg (1)

34-35: Improved function type checking approach

The change from using set_eq with a query to the pg_proc catalog to using the function_types_eq helper function is a good improvement. The human-readable type specifications make the tests more maintainable and easier to understand than OID-based checks.

pgtap/ordering/cuthillMckeeOrdering/types_check.pg (1)

46-49: Good standardization of type checking

This refactoring consistently applies the new pattern of using function_types_eq with human-readable type arrays. The improved readability will make these tests easier to maintain long-term.

pgtap/topology/nodeNetwork/types_check.pg (1)

33-35: Consistent implementation of improved type checking

This change follows the same pattern as the other files, replacing OID-based type checking with human-readable type names. The standardization across the codebase improves maintainability.

pgtap/trsp/trspViaEdges/types_check.pg (1)

38-41: Improvement in type checking clarity

The change from using set_eq with a pg_proc query to function_types_eq with explicit type names improves code readability and maintainability. Using human-readable TEXT array representation (text,_int4,_float8,bool,bool,text,int4,int4,int4,int4,float8) instead of numeric OIDs makes the expected function signature much clearer to understand.

pgtap/transitiveClosure/types_check.pg (1)

40-43: Enhanced type checking with clear type names

The refactoring replaces the OID-based approach with a more readable type checking method using function_types_eq. The TEXT array representation makes it immediately clear what types the function expects (text,int4,int8,_int8), improving test maintainability.

pgtap/ordering/topologicalSort/types_check.pg (1)

1-54: Well-structured test for topological sort functionality

This new test file for pgr_topologicalsort follows the established pattern used in other type checking tests. It properly validates the function's existence, argument types, and return type using the improved function_types_eq approach with explicit type names rather than OIDs.

pgtap/coloring/edgeColoring/types_check.pg (1)

46-49: Consistent improvement in type checking readability

This change continues the pattern of replacing OID-based checks with the more readable function_types_eq approach. The TEXT array representation (text,int8,int8) makes the expected argument types immediately clear, improving test maintainability.

pgtap/alpha_shape/types_check.pg (1)

27-29: Improved type checking approach.

The change from using a CTE with set_eq to using function_types_eq directly is a good improvement. This simplifies the code while maintaining the same functionality. The use of human-readable TEXT arrays (geometry,float8) instead of OIDs makes the tests more maintainable.

Note that the comment on line 26 saying "pgtap does not like geometry type, this is a workaround" might be obsolete now if function_types_eq handles geometry types properly.

pgtap/contraction/contractionLinear/types_check.pg (1)

43-44: Standardized type checking approach.

The change to use function_types_eq is consistent with the standardization of type checking across the codebase. This makes the code more maintainable by using a dedicated function for type checking rather than raw SQL queries with set_eq.

pgtap/components/biconnectedComponents/types_check.pg (1)

34-36: Enhanced readability with text-based type checking.

Replacing OID-based type checking with human-readable text types (text,int8,int8,int8) improves code clarity and maintainability. The function_types_eq approach is more direct and easier to understand than the previous set_eq with pg_proc queries.

pgtap/topology/extractVertices/types_check.pg (1)

33-34: Good refactoring to use human-readable type names.

The change from using a set_eq with OID values to function_types_eq with human-readable type names (text, bool, int8, etc.) improves code readability and maintainability. This approach makes it much clearer what type signatures are being validated.

pgtap/ksp/ksp/types_check.pg (2)

54-60: Good upgrade to use human-readable type names instead of OIDs.

This refactoring replaces OID-based type checking with explicit human-readable type names. The change makes the test more maintainable and easier to understand by directly specifying PostgreSQL data types like text, int8, bool, etc. instead of numeric OIDs.


70-71: Improved readability with text-based type names.

Good change to use explicit text representation of PostgreSQL types instead of OIDs in the else branch as well. Consistent with the approach used in the conditional branch above.

pgtap/bdDijkstra/bdDijkstraCostMatrix/types_check.pg (1)

34-36: Improved type checking with descriptive type names.

The change from using OID-based type checking to explicit human-readable type names makes the test more maintainable. The new approach with function_types_eq using clear type names like text, anyarray, bool is much easier to understand and maintain.

pgtap/circuits/hawickCircuits/types_check.pg (1)

50-52: Better type validation with human-readable formats.

The switch from OID-based type validation to descriptive TEXT array with function_types_eq improves code readability and maintainability. The explicit type names make it much clearer what the expected function signature should be.

pgtap/chinese/chinesePostman/types_check.pg (1)

34-34: Improved type checking with function_types_eq

The change from using a raw query with set_eq to a more specialized function_types_eq function improves readability and maintainability. The human-readable TEXT array representation of types (text, int4, int8, etc.) is much clearer than using numeric OIDs, making the tests easier to understand and maintain.

pgtap/dominator/lengauerTarjanDominatorTree/types_check.pg (1)

46-49: Improved type checking implementation

The modification correctly changes the type checking from a custom query to a dedicated function_types_eq function, using human-readable type names like 'text' and 'int8' rather than numeric OIDs. This makes the test more maintainable and consistent with the project's modernization efforts.

pgtap/trsp/trspViaVertices/types_check.pg (1)

37-40: Improved type checking with standardized approach

The modification correctly replaces the database query approach with the dedicated function_types_eq function, using human-readable type names. This enhances readability and maintainability of the test by making the expected function signature more explicit.

pgtap/traversal/depthFirstSearch/types_check.pg (1)

51-56: Improved type checking with better readability for multiple signatures

The modification successfully replaces OID-based type checking with the clearer function_types_eq approach using human-readable type names. The code effectively handles checking both function signatures (single vertex and array of vertices inputs) in a more maintainable way.

pgtap/metrics/betweennessCentrality/types_check.pg (1)

50-52: Improved type checking with human-readable types

The switch from using a direct query against pg_proc to using the function_types_eq function with text-based type definitions improves code readability and maintainability. Using human-readable type names (text, bool, int8, float8) instead of OIDs makes the expected function signature much clearer.

pgtap/withPoints/withPoints/types_check.pg (2)

63-70: Enhanced type validation with descriptive type names

The refactoring to use function_types_eq with human-readable type names is a significant improvement. This change makes the test more maintainable by:

  1. Using clear type names (text, int8, bool, etc.) instead of cryptic OID numbers
  2. Maintaining consistency with other type checks in the codebase
  3. Simplifying the validation logic

The conditional block structure is properly maintained to handle version differences.


83-89: Consistent approach for older versions

Good implementation of the same pattern for older versions, ensuring consistent type checking regardless of pgRouting version. This maintains backward compatibility while improving readability.

pgtap/trsp/trsp/types_check.pg (1)

40-49: Standardized function argument type checking

Great refactoring from bag_has to function_types_eq, which aligns with the project-wide approach to type validation. The human-readable type format makes the test more maintainable and the expected function signatures easier to understand.

Multiple function signatures are properly defined to cover all variants of the pgr_trsp function, ensuring comprehensive validation.

pgtap/traversal/breadthFirstSearch/types_check.pg (1)

41-46: Enhanced type checking with descriptive type names

The switch to function_types_eq with human-readable type names improves test clarity and maintainability. This change eliminates the need to look up OID values and makes the expected function signatures immediately clear to developers.

Both single-value and array-based parameter variants are properly defined in the test.

pgtap/max_flow/maxFlowMinCost/types_check.pg (1)

63-71: Improved type checking with better readability

The change from direct SQL queries with set_eq to using function_types_eq with human-readable TEXT arrays improves code maintainability. Type names like 'text' and 'int8' are more intuitive than OID values, making the tests easier to understand and maintain.

pgtap/dijkstra/dijkstraCost/types_check.pg (1)

63-70: Streamlined type checking with descriptive type names

Good replacement of OID-based checks with the more direct function_types_eq approach. This change improves readability by using descriptive type names instead of numeric OIDs.

pgtap/withPoints/withPointsCost/types_check.pg (1)

63-71: Enhanced function signature validation

This change consistently follows the same pattern of improvement seen in other files, replacing OID-based type checking with more readable TEXT representations of PostgreSQL types.

tools/testers/tsp_pgtap_tests.sql (1)

187-189: Improved consistency in type checking

Good refactoring to use function_types_eq for clearer type validation, consistent with changes in other files.

pgtap/traversal/binaryBreadthFirstSearch/types_check.pg (2)

67-75: Improved type checking with human-readable format

The modification replaces OID-based type checking with human-readable TEXT arrays using the function_types_eq function. This enhances code readability and maintainability by making the expected argument types explicit (e.g., 'text', 'int8', 'bool') rather than using numeric OIDs.


89-95: Consistent type definition approach in else branch

The same pattern of using function_types_eq with TEXT arrays has been correctly applied in the else branch as well, maintaining consistency throughout the conditional logic.

pgtap/dijkstra/dijkstraNearCost/types_check.pg (1)

63-68: Converted to explicit type definitions using TEXT arrays

The code now uses function_types_eq with human-readable type names instead of numeric OIDs, improving readability and making the test more maintainable. The expected argument types are now clearly defined as text, anyarray, int8, etc.

pgtap/components/strongComponenets/types_check.pg (1)

34-35: Improved type checking with human-readable format

The change replaces OID-based type checking (previous implementation) with the more readable function_types_eq function using explicit TEXT array. This makes the expected argument types for pgr_strongcomponents clearer and easier to understand.

pgtap/max_flow/maxFlowMinCost_Cost/types_check.pg (1)

21-21: Updated test plan count

The number of planned tests has been reduced from 14 to 13, which should correctly align with the actual number of tests being executed in this script.

pgtap/bdDijkstra/bdDijkstraCost/types_check.pg (2)

63-71: Improved type checking with human-readable format

The changes replace the old OID-based type checking approach with a more readable TEXT array format using the function_types_eq function. This improves code readability and maintenance by using explicit type names like 'text', 'int8', and 'bool' instead of numeric OIDs.


83-90: Consistent refactoring of type checking mechanism

This change maintains consistency with the earlier conditional block by using the same function_types_eq approach for earlier versions, improving maintainability while preserving the conditional logic.

pgtap/bellman_ford/edwardMoore/types_check.pg (2)

67-74: Enhanced readability with function_types_eq

The code now uses the more intuitive function_types_eq function with human-readable type names instead of querying OIDs directly from pg_proc. This makes the test more maintainable and easier to understand.


89-96: Consistent approach for version-dependent type checking

The same improvement has been applied to the ELSE block for compatibility with earlier versions, ensuring a consistent approach throughout the conditional logic.

pgtap/utilities/findCloseEdges/types_check.pg (2)

58-64: Changed function_types to function_types_eq

The function call has been updated from function_types to function_types_eq, which is consistent with the changes in other files, improving the standardization of type checking across the codebase.


77-81: Consistent type checking approach for older versions

The same function update has been applied to the ELSE block, ensuring consistency in the type checking methodology regardless of version.

pgtap/ordering/topologicalSort/no_crash_test.pg (1)

1-77: Well-structured test for topological sort functionality

This new test file is well-designed, testing the pgr_topologicalsort function's existence, return types, error handling, and basic functionality. It follows the established testing patterns used throughout the pgtap suite.

The test:

  1. Sets up appropriate test data in lines 25-33
  2. Verifies function existence and return types in lines 35-37
  3. Tests error handling with invalid parameters in lines 40-46
  4. Confirms the function works with valid inputs in lines 49-53
  5. Properly checks the return column types in lines 56-73

This comprehensive approach ensures the function behaves correctly and maintains compatibility with the expected interfaces.

pgtap/max_flow/edgedisjointpaths/types_check.pg (2)

60-66: Improved type checking with readable type names.

The change replaces OID-based type checking with human-readable type names using the function_types_eq function. This enhances code readability and maintainability.


80-85: Improved type checking in the fallback condition.

Similar to the previous section, this change replaces OID-based type checking with human-readable type names in the ELSE block for versions before 3.2.0.

tools/testers/astar_pgtap_tests.sql (9)

6-6: Enhanced type variable naming for better readability.

Changed the_type_numb to use human-readable PostgreSQL type names ('float8') instead of OIDs, improving code clarity.

Also applies to: 11-11


44-51: Improved type checking with descriptive type names.

Changed from using set_eq with OID-based types to function_types_eq with human-readable type names, making the code more maintainable.


64-71: Consistent type checking approach for earlier versions.

Similar to the previous change, updated the type checking mechanism for PostgreSQL versions before 3.6.0 to use human-readable type names.


82-88: Standardized type checking for legacy versions.

Updated the type checking approach for PostgreSQL versions before 3.2.0 to use the more readable text-based format.


99-99: Enhanced variable type naming in astarcost_types_check.

Changed type representation from OIDs to human-readable PostgreSQL type names for better code clarity.

Also applies to: 104-104


137-144: Improved type checking in astarcost_types_check.

Replaced OID-based type checking with human-readable type names using the function_types_eq function.


155-160: Standardized type checking for earlier versions in astarcost_types_check.

Consistent with other changes, updated the type checking mechanism for earlier PostgreSQL versions.


172-172: Enhanced variable type naming in astarcostmatrix_types_check.

Changed from OIDs to human-readable PostgreSQL type names, improving code clarity.

Also applies to: 177-177


192-194: Improved type checking in astarcostmatrix_types_check.

Updated the type checking approach to use human-readable type names.

tools/testers/flow_pgtap_tests.sql (2)

201-207: Improved type checking with human-readable type names.

Replaced OID-based type checking with a more readable text-based format using the function_types_eq function. This enhancement makes the code more maintainable.


221-226: Consistent type checking approach for earlier versions.

Updated the type checking mechanism for earlier PostgreSQL versions to use the same improved format with human-readable type names.

pgtap/ksp/withPointsKSP/types_check.pg (2)

52-59: Improved type checking with descriptive type names.

Replaced OID-based type checking with human-readable PostgreSQL type names using the function_types_eq function. This change enhances code clarity and maintainability.


68-69: Standardized type checking for earlier versions.

Consistent with the approach across other files, updated the type checking for earlier PostgreSQL versions to use human-readable type names.

tools/testers/spanningtree.sql (5)

14-16: Good refactoring to improve type checking readability.

The change from using set_eq with PostgreSQL catalog queries to function_types_eq with explicit TEXT arrays makes the code more readable and maintainable. Using human-readable type names (text, int8, float8) instead of OIDs improves clarity for future developers.


42-46: Improved type definition with human-readable types.

The transition from OID-based type checking to explicit TEXT arrays makes the expected function signatures much clearer. This approach is more maintainable and less prone to errors when PostgreSQL internal OIDs change between versions.


58-62: Consistent refactoring pattern applied throughout the file.

The changes maintain consistency with the version-specific checks while improving readability. Using explicit type arrays makes it easier to understand what argument types are expected by the function.


96-104: Well-structured type validation for multiple function overloads.

The new approach handles multiple function signatures nicely with explicit type arrays. This implementation makes it much clearer what types are expected for each parameter compared to the previous OID-based approach.


116-124: Consistent approach across version-conditional branches.

The same improvement pattern has been applied to both conditional branches, maintaining consistency throughout the file while improving readability and maintainability.

pgtap/withPoints/withPointsDD/types_check.pg (1)

58-64: Clean refactoring to more readable type checks.

The change from set_eq with PostgreSQL catalog queries to function_types_eq with explicit TEXT arrays improves clarity. Using human-readable types like text, anyarray, and float8 makes it easier to understand the function signatures.

tools/testers/general_pgtap_tests.sql (2)

53-67: Improved function naming and implementation.

The function has been renamed from what was likely function_types to function_types_eq, which better reflects its purpose (it uses set_eq internally). The implementation has been enhanced to:

  1. Use coalesce(p.proallargtypes, p.proargtypes) which makes it more robust by handling cases where proallargtypes might be NULL
  2. Properly reference the pg_catalog schema for system tables, following best practices
  3. Provide clearer context in the error message by including the function name

These changes improve both robustness and maintainability of the type checking system.


69-83: Good addition of a complementary set_has version.

Adding function_types_has that uses set_has instead of set_eq provides more flexibility for type checking. This allows testing that a function has certain type signatures without requiring an exact match for all signatures, which can be useful in certain testing scenarios.

The implementation correctly follows the same pattern as function_types_eq, ensuring consistency across the codebase.

pgtap/dijkstra/driving_distance/types_check.pg (2)

47-51: Improved readability with explicit type names.

Replacing OID-based type checking with human-readable type names improves code clarity. The TEXT array {text,int8,float8,bool,int8,int8,int8,int8,int8,int8,float8,float8} is much more meaningful than an equivalent OID array.


63-67: Consistent refactoring in version-specific logic.

The changes maintain consistency with the version-specific checks while improving readability. Note that this branch uses int4 for the sequence ID rather than int8 in the newer version, which correctly preserves the function's evolution across versions.

pgtap/max_flow/maxCardinalityMatch/types_check.pg (2)

43-47: Improved type checking readability through function_types_eq

The change from OID-based type checking to human-readable TEXT arrays is a good improvement for code maintainability. The new approach using function_types_eq with explicit type names (text, bool, int4, etc.) makes it much clearer what data types are expected for the pgr_maxcardinalitymatch function arguments.


56-57: Consistent use of function_types_eq in ELSE block

The change to function_types_eq in the ELSE block maintains consistency with the approach used in the first conditional block. Using TEXT arrays instead of OIDs improves readability and makes maintenance easier.

pgtap/bellman_ford/bellman_ford/types_check.pg (2)

67-74: Enhanced type checking with explicit TEXT arrays

The replacement of OID arrays with explicit TEXT arrays in function_types_eq significantly improves code readability. The new approach clearly indicates the expected argument types for the pgr_bellmanford function, making it easier for developers to understand the function's interface.


89-95: Consistent type checking in ELSE block

The ELSE block has been updated consistently with the same TEXT array approach. This standardized approach to type checking across different code paths is good practice and improves maintainability.

pgtap/contraction/contraction/types_check.pg (2)

39-41: Unified approach to function type checking

The change from a previous check to function_types_eq with explicit TEXT arrays aligns this code with the new type-checking pattern being implemented across the codebase. Using human-readable type names enhances code clarity.


51-53: Consistent implementation in ELSE block

The ELSE block has been updated to use the same function_types_eq approach, maintaining consistency throughout the conditional branches. This unified approach to type checking makes the code more maintainable.

pgtap/dijkstra/dijkstraNear/types_check.pg (1)

63-69: Improved readability with explicit type specifications

The change to function_types_eq with TEXT arrays significantly improves the readability of the type checking code. Using descriptive type names like 'text', 'bool', 'int8', etc. instead of OIDs makes it immediately clear what types are expected for each function parameter.

pgtap/metrics/degree/types_check.pg (2)

51-55: Improved type checking with function_types_eq

The change replaces the previous OID-based type checking (set_eq with raw OIDs) with a more readable and maintainable approach using function_types_eq with human-readable type names. This makes the test more understandable and less prone to errors when maintaining the code.


63-64: Improved type checking for non-3.8.0 versions

Similar to the previous change, this replaces the OID-based type checking with the more readable function_types_eq approach for versions before 3.8.0. The human-readable type names (text, text, bool, int8, int8) provide better clarity than the previous numeric OIDs.

tools/testers/dijkstra_pgtap_tests.sql (3)

161-168: Enhanced type checking for pgr_dijkstra in version 3.5.0+

The change replaces OID-based type checking with the more maintainable function_types_eq function that uses human-readable type names. This significantly improves code readability and makes future maintenance easier, particularly when understanding function signatures.


187-194: Improved type checking for conditional version case

For versions that match the condition (min_version('3.2.0') AND fn != 'pgr_dijkstra') OR (min_version('3.1.0') AND fn = 'pgr_dijkstra'), the change replaces numeric OIDs with human-readable type names. This makes the test more understandable and consistent with the other changes.


206-211: Standardized type checking for earlier versions

For earlier versions (the ELSE block), the change follows the same pattern of replacing OID-based type checking with human-readable type names through the function_types_eq function. This maintains consistency throughout the codebase and improves readability.

Comment on lines +33 to 36

SELECT function_types_eq('pgr_analyzegraph',
$$SELECT '{text,float8,text,text,text,text,text}'::TEXT[]$$
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Improved type checking with better readability.

The change to use function_types_eq with human-readable type names (text,float8,text,text,text,text,text) instead of OIDs enhances code clarity and consistency with other test files. This standardized approach makes the tests more maintainable.

Consider removing the extra blank line at line 33 for style consistency.

-

-
 SELECT function_types_eq('pgr_analyzegraph',
   $$SELECT '{text,float8,text,text,text,text,text}'::TEXT[]$$
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
SELECT function_types_eq('pgr_analyzegraph',
$$SELECT '{text,float8,text,text,text,text,text}'::TEXT[]$$
);
SELECT function_types_eq('pgr_analyzegraph',
$$SELECT '{text,float8,text,text,text,text,text}'::TEXT[]$$
);

Comment on lines +235 to 237
SELECT function_types_eq(fn,
$$SELECT '{text,int8,int8,float823,23,23,float8float8float816,23,int8,float8,float8}'::TEXT[] $$
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix missing separators in type array

The TEXT array containing type names appears to be missing proper separators between some data types.

-    $$SELECT '{text,int8,int8,float823,23,23,float8float8float816,23,int8,float8,float8}'::TEXT[] $$
+    $$SELECT '{text,int8,int8,float8,23,23,23,float8,float8,float8,16,23,int8,float8,float8}'::TEXT[] $$

The current format contains concatenated type names like float823 and float8float8float816 which should be separated with commas.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
SELECT function_types_eq(fn,
$$SELECT '{text,int8,int8,float823,23,23,float8float8float816,23,int8,float8,float8}'::TEXT[] $$
);
SELECT function_types_eq(fn,
$$SELECT '{text,int8,int8,float8,23,23,23,float8,float8,float8,16,23,int8,float8,float8}'::TEXT[] $$
);

Comment on lines +51 to 58
function_types_eq('pgr_maxflow',
$$VALUES
('{25,25}'::OID[]),
('{25,20,20}'::OID[]),
('{25,20,2277}'::OID[]),
('{25,2277,20}'::OID[]),
('{25,2277,2277}'::OID[])
('{text,text}'::TEXT[]),
('{text,int8,int8}'),
('{text,int8,anyarray}'),
('{text,anyarray,int8}'),
('{text,anyarray,anyarray}')
$$)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Function name mismatch in type check

The file appears to be testing pgr_maxflowmincost_cost based on the function checks at the top, but the function_types_eq call is checking pgr_maxflow instead. This inconsistency could cause the test to fail or produce incorrect results.

Correct the function name to match the function being tested:

- function_types_eq('pgr_maxflow',
+ function_types_eq('pgr_maxflowmincost_cost',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function_types_eq('pgr_maxflow',
$$VALUES
('{25,25}'::OID[]),
('{25,20,20}'::OID[]),
('{25,20,2277}'::OID[]),
('{25,2277,20}'::OID[]),
('{25,2277,2277}'::OID[])
('{text,text}'::TEXT[]),
('{text,int8,int8}'),
('{text,int8,anyarray}'),
('{text,anyarray,int8}'),
('{text,anyarray,anyarray}')
$$)
function_types_eq('pgr_maxflowmincost_cost',
$$VALUES
('{text,text}'::TEXT[]),
('{text,int8,int8}'),
('{text,int8,anyarray}'),
('{text,anyarray,int8}'),
('{text,anyarray,anyarray}')
$$)

Comment on lines +60 to 66
function_types_eq('pgr_maxflow',
$$VALUES
('{25,20,20}'::OID[]),
('{25,20,2277}'::OID[]),
('{25,2277,20}'::OID[]),
('{25,2277,2277}'::OID[])
('{text,int8,int8}'::TEXT[]),
('{text,int8,anyarray}'),
('{text,anyarray,int8}'),
('{text,anyarray,anyarray}')
$$)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Function name mismatch in ELSE branch

The same inconsistency exists in the ELSE branch. The function name should be pgr_maxflowmincost_cost to match the function being tested.

Correct the function name in the ELSE branch as well:

- function_types_eq('pgr_maxflow',
+ function_types_eq('pgr_maxflowmincost_cost',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function_types_eq('pgr_maxflow',
$$VALUES
('{25,20,20}'::OID[]),
('{25,20,2277}'::OID[]),
('{25,2277,20}'::OID[]),
('{25,2277,2277}'::OID[])
('{text,int8,int8}'::TEXT[]),
('{text,int8,anyarray}'),
('{text,anyarray,int8}'),
('{text,anyarray,anyarray}')
$$)
function_types_eq('pgr_maxflowmincost_cost',
$$VALUES
('{text,int8,int8}'::TEXT[]),
('{text,int8,anyarray}'),
('{text,anyarray,int8}'),
('{text,anyarray,anyarray}')
$$)

Comment on lines +41 to +46
SELECT throws_ok(
'SELECT * FROM pgr_topologicalsort(
''SELECT id, source, target, cost, reverse_cost FROM edges id < 2'',
3
)','42883','function pgr_topologicalsort(unknown, integer) does not exist',
'6: Documentation says it does not work with 1 flags');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix SQL syntax in error test

There's a syntax error in the SQL query used in the throws_ok test - missing WHERE keyword.

-        ''SELECT id, source, target, cost, reverse_cost FROM edges id < 2'',
+        ''SELECT id, source, target, cost, reverse_cost FROM edges WHERE id < 2'',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
SELECT throws_ok(
'SELECT * FROM pgr_topologicalsort(
''SELECT id, source, target, cost, reverse_cost FROM edges id < 2'',
3
)','42883','function pgr_topologicalsort(unknown, integer) does not exist',
'6: Documentation says it does not work with 1 flags');
SELECT throws_ok(
'SELECT * FROM pgr_topologicalsort(
''SELECT id, source, target, cost, reverse_cost FROM edges WHERE id < 2'',
3
)','42883','function pgr_topologicalsort(unknown, integer) does not exist',
'6: Documentation says it does not work with 1 flags');

Comment on lines +22 to +23
UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost);
SELECT plan(5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider using a test-specific table instead of modifying the shared edges table

The code updates the shared edges table in line 22, which could potentially affect other tests running in the same session if they depend on specific values in the cost and reverse_cost columns.

Consider creating and using a dedicated test-specific table similar to how edges1 is created later, rather than modifying the shared table:

-UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost);
+CREATE TABLE edges_topo AS SELECT id, source, target, sign(cost) as cost, sign(reverse_cost) as reverse_cost FROM edges;

Then use this table in your test queries instead of the shared edges table.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost);
SELECT plan(5);
CREATE TABLE edges_topo AS SELECT id, source, target, sign(cost) as cost, sign(reverse_cost) as reverse_cost FROM edges;
SELECT plan(5);

Comment on lines +74 to 78
function_types_eq('pgr_withpointsdd',
$$VALUES
('{25,25,20,701,16,1042,16,23,20,20,701,701}'::OID[]),
('{25,25,2277,701,16,1042,16,16,23,20,20,20,701,701}'::OID[])
('{text,text,anyarray,float8,bool,bpchar,bool,bool,int4,int8,int8,int8,float8,float8}'::TEXT[]),
('{text,text,int8,float8,bool,bpchar,bool,int4,int8,int8,float8,float8}')
$$)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Missing type cast in function signature array.

Line 77 is missing the ::TEXT[] cast that's present in all other similar type definitions. This could cause the test to fail.

-('{text,text,int8,float8,bool,bpchar,bool,int4,int8,int8,float8,float8}')
+('{text,text,int8,float8,bool,bpchar,bool,int4,int8,int8,float8,float8}'::TEXT[])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function_types_eq('pgr_withpointsdd',
$$VALUES
('{25,25,20,701,16,1042,16,23,20,20,701,701}'::OID[]),
('{25,25,2277,701,16,1042,16,16,23,20,20,20,701,701}'::OID[])
('{text,text,anyarray,float8,bool,bpchar,bool,bool,int4,int8,int8,int8,float8,float8}'::TEXT[]),
('{text,text,int8,float8,bool,bpchar,bool,int4,int8,int8,float8,float8}')
$$)
function_types_eq('pgr_withpointsdd',
$$VALUES
('{text,text,anyarray,float8,bool,bpchar,bool,bool,int4,int8,int8,int8,float8,float8}'::TEXT[]),
('{text,text,int8,float8,bool,bpchar,bool,int4,int8,int8,float8,float8}'::TEXT[])
$$)

@cvvergara cvvergara closed this Mar 31, 2025
@cvvergara cvvergara deleted the issue-tbd-wrap-pg_proc-test-functions branch April 1, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant