citusdata / citusdata/citus

Prohibit non-IMMUTABLE functions in multi-shard SELECT queries

Open
#224 2 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

**Issue by [jasonmp85](https://github.com/jasonmp85)**
_Thursday Jan 22, 2015 at 23:09 GMT_
_Originally opened as https://github.com/citusdata/pg_shard/issues/60_

---

Though all (non-side-effecting) functions are safe to execute in a single-shard `SELECT` query, the same is not true for multi-shard SELECTs. In particular, a function such as `random()` or `now()` would return a different value for each shard and so the query results would not represent a consistent view of the world.

This may overlap somewhat with [47](https://github.com/citusdata/pg_shard/issues/47), but that issue is more concerned with single-shard ramifications. We've noticed this bug affects multi-shard queries as well, so they'll need similar treatment.

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by locating the multi-shard SELECT validation or planning path and its handling of PostgreSQL function volatility; done means non-IMMUTABLE functions such as random() and now() are rejected for multi-shard queries, with coverage for those cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.