Skip to content
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

Allow overloaded functions (name+param combinations) #803

Open
nyurik opened this issue Aug 13, 2023 · 0 comments
Open

Allow overloaded functions (name+param combinations) #803

nyurik opened this issue Aug 13, 2023 · 0 comments
Labels
config Relates to Martin configuration enhancement help wanted pg Related to PostgreSQL sources

Comments

@nyurik
Copy link
Member

nyurik commented Aug 13, 2023

PR #543 adds a few more unit tests:

"MixedCase".function_dup(int, int, int)
"MixedCase"."function_Dup"(int, int, int)
"MixedCase".function_dup(int, int, int, json)
"MixedCase".function_dup(int, int, int, jsonb)

Martin should be able to create these with de-duplicated names, e.g. function_dup.1, function_dup.2, etc.

Implementation notes

  • The complex part is that configuration must be able to support multiple argument types. Config spec may need to be expanded, and we would need to support function argument parsing. Parsing should also do some basic PostgeSQL type normalization like int -> int4 and bigint -> int8
postgres:
  functions:
    function_source_id:
      schema: "public"
      # Idea 1: more ergonomic, but harder to implement:
      function: "function_zxy_query(int4, int4, int4)"
      # Idea 2: less ergonomic but simpler
      function: function_zxy_query
      args: ["int4", "int4", "int4"]
  • fn query_available_function(...) -> InfoMap<InfoMap<(PgSqlInfo, FunctionInfo)>>, which is a HashMap<String, HashMap<String, (PgSqlInfo, FunctionInfo)>> - in other words a map of schema name to a map of function name (unique) to all the data about the given function. In order to support multiple names, it would have to be changed to something like this: InfoMap<InfoMap<HashMap<Vec<String>, (PgSqlInfo, FunctionInfo)>>> (list of arguments is used as a key to arguments).
@nyurik nyurik added help wanted config Relates to Martin configuration pg Related to PostgreSQL sources labels Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Relates to Martin configuration enhancement help wanted pg Related to PostgreSQL sources
Projects
None yet
Development

No branches or pull requests

1 participant