citusdata / citusdata/citus

Parameters to SQL functions are not supported

Open
#1,179 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

As SQL function contents are always executed with prepared statement parameters in place, without using the plancache/custom plan logic, our current implementation of prepared statements doesn't work for SQL functions.

The current state of prepared statement support is:

| | prepare | pl/pgsql | sql function |
| :-- | :-- | :-- | :-- |
| **Router Executor** | | | |
| Select - Partition Column | Always | Always | Fails (uses real-time) |
| Insert - Partition Column | Always | Always | Fails |
| Update - Partition Column | Always | Always | Fails |
| Delete - Partition Column | Always | Always | Fails |
| Select - Non-Partition Column | Always | Always | Fails (uses real-time) |
| Insert - Non-Partition Column | Always | Always | Always |
| Update - Non-Partition Column | Always | Always | Always |
| Delete - Non-Partition Column | Always | Always | Always |
| **Real-time Executor** | | | |
| Partition Column | Always | Always | Fails |
| Non-Partition Column | Always | Always | Fails |
| **Task-tracker Executor** | | | |
| Partition Column | Always | Always | Fails |
| Non-Partition Column | Always | Always | Fails |

There are no immediate plans to implement parameters to SQL functions. Therefore for now the fix is to use plpgsql (or other languages) instead of sql functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.