Routine Options
Options for handling PostgreSQL routines (functions and procedures).
Overview
json
{
"NpgsqlRest": {
"RoutineOptions": {
"CustomTypeParameterSeparator": null,
"IncludeLanguages": null,
"ExcludeLanguages": null
}
}
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
CustomTypeParameterSeparator | string | null | Separator for custom type parameter names. Uses underscore (_) if null. |
IncludeLanguages | array | null | List of routine language names to include. Includes all if null. Case-insensitive. |
ExcludeLanguages | array | null | List 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) ...1
2
3
2
3
With default separator (_), the parameter name becomes _p_value.
To use a different separator:
json
{
"NpgsqlRest": {
"RoutineOptions": {
"CustomTypeParameterSeparator": "."
}
}
}1
2
3
4
5
6
7
2
3
4
5
6
7
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"]
}
}
}1
2
3
4
5
6
7
2
3
4
5
6
7
Exclude Additional Languages
To exclude additional languages beyond the defaults:
json
{
"NpgsqlRest": {
"RoutineOptions": {
"ExcludeLanguages": ["C", "INTERNAL", "plpython3u"]
}
}
}1
2
3
4
5
6
7
2
3
4
5
6
7
Common PostgreSQL Languages
| Language | Description |
|---|---|
sql | Plain SQL functions |
plpgsql | PL/pgSQL procedural language |
plpython3u | PL/Python (untrusted) |
plperl | PL/Perl |
pltcl | PL/Tcl |
C | C language (excluded by default) |
INTERNAL | Internal PostgreSQL functions (excluded by default) |
Complete Example
json
{
"NpgsqlRest": {
"RoutineOptions": {
"CustomTypeParameterSeparator": "_",
"IncludeLanguages": ["plpgsql", "sql"],
"ExcludeLanguages": null
}
}
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Related
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works
Next Steps
- NpgsqlRest Options - Parent configuration options
- Authentication Options - Per-endpoint authentication