Skip to content

Routine Options

Options for handling PostgreSQL routines (functions and procedures).

Overview

json
{
  "NpgsqlRest": {
    "RoutineOptions": {
      "CustomTypeParameterSeparator": null,
      "IncludeLanguages": null,
      "ExcludeLanguages": null
    }
  }
}

Settings

SettingTypeDefaultDescription
CustomTypeParameterSeparatorstringnullSeparator for custom type parameter names. Uses underscore (_) if null.
IncludeLanguagesarraynullList of routine language names to include. Includes all if null. Case-insensitive.
ExcludeLanguagesarraynullList of routine language names to exclude. Excludes C and INTERNAL if null. Case-insensitive.

Custom Type Parameter Separator

When using custom types for parameters, field names are merged with the parameter name:

sql
create type custom_type1 as (value text);

create function my_func(_p custom_type1) ...

With default separator (_), the parameter name becomes _p_value.

To use a different separator:

json
{
  "NpgsqlRest": {
    "RoutineOptions": {
      "CustomTypeParameterSeparator": "."
    }
  }
}

This would result in _p.value instead.

Language Filtering

By default, routines written in C and INTERNAL are excluded for security reasons. You can customize which languages are included or excluded.

Include Specific Languages

To only expose routines written in specific languages:

json
{
  "NpgsqlRest": {
    "RoutineOptions": {
      "IncludeLanguages": ["plpgsql", "sql"]
    }
  }
}

Exclude Additional Languages

To exclude additional languages beyond the defaults:

json
{
  "NpgsqlRest": {
    "RoutineOptions": {
      "ExcludeLanguages": ["C", "INTERNAL", "plpython3u"]
    }
  }
}

Common PostgreSQL Languages

LanguageDescription
sqlPlain SQL functions
plpgsqlPL/pgSQL procedural language
plpython3uPL/Python (untrusted)
plperlPL/Perl
pltclPL/Tcl
CC language (excluded by default)
INTERNALInternal PostgreSQL functions (excluded by default)

Complete Example

json
{
  "NpgsqlRest": {
    "RoutineOptions": {
      "CustomTypeParameterSeparator": "_",
      "IncludeLanguages": ["plpgsql", "sql"],
      "ExcludeLanguages": null
    }
  }
}

Next Steps

Released under the MIT License.