citus/src/backend/distributed
Onder Kalaci 975c4c2264 Do not prune shards if the distribution key is NULL
The root of the problem is that, standard_planner() converts the following qual

```
   {OPEXPR
   :opno 98
   :opfuncid 67
   :opresulttype 16
   :opretset false
   :opcollid 0
   :inputcollid 100
   :args (
      {VAR
      :varno 1
      :varattno 1
      :vartype 25
      :vartypmod -1
      :varcollid 100
      :varlevelsup 0
      :varnoold 1
      :varoattno 1
      :location 45
      }
      {CONST
      :consttype 25
      :consttypmod -1
      :constcollid 100
      :constlen -1
      :constbyval false
      :constisnull true
      :location 51
      :constvalue <>
      }
   )
   :location 49
   }
```

To

```
(
   {CONST
   :consttype 16
   :consttypmod -1
   :constcollid 0
   :constlen 1
   :constbyval true
   :constisnull true
   :location -1
   :constvalue <>
   }
)
```

So, Citus doesn't deal with NULL values in real-time or non-fast path router queries.

And, in the FastPathRouter planner, we check constisnull in DistKeyInSimpleOpExpression().
However, in deferred pruning case, we do not check for isnull for const.

Thus, the fix consists of two parts:
- Let PruneShards() not crash when NULL parameter is passed
- For deferred shard pruning in fast-path queries, explicitly check that we have CONST which is not NULL
2020-02-13 15:00:31 +01:00
..
commands Fix typos noticed while reading through code trying to understand HAVING 2020-02-11 19:55:10 +00:00
connection dont: don't, wont: won't, acylic: acyclic 2020-02-05 17:32:22 +00:00
deparser Adds propagation for grant on schema commands 2020-01-20 14:51:28 +03:00
executor Do not prune shards if the distribution key is NULL 2020-02-13 15:00:31 +01:00
master Fix typos noticed while reading through code trying to understand HAVING 2020-02-11 19:55:10 +00:00
metadata Introduce objects to dist. infrastructure when updating Citus (#3477) 2020-02-07 18:07:59 +03:00
planner Do not prune shards if the distribution key is NULL 2020-02-13 15:00:31 +01:00
progress Automatically convert useless declarations using regex replace (#3181) 2019-11-21 13:47:29 +01:00
relay Adds alter table schema propagation 2020-01-16 17:04:16 +03:00
sql Use current user for repartition join temp schemas. 2020-02-04 09:48:20 -08:00
test CitusRemoveDirectory: loop when directory is not empty 2020-01-30 20:02:08 +00:00
transaction Fix typos noticed while reading through code trying to understand HAVING 2020-02-11 19:55:10 +00:00
utils Fix typos noticed while reading through code trying to understand HAVING 2020-02-11 19:55:10 +00:00
worker Fix typos noticed while reading through code trying to understand HAVING 2020-02-11 19:55:10 +00:00
.gitignore Change SQL migration build process for easier reviews (#2951) 2019-09-13 18:44:27 +02:00
Makefile Makefile fix DESTDIR together with cleanup (#3342) 2019-12-27 10:34:57 +01:00
citus----9.3-1.sql Bump citus version to 9.3devel (#3482) 2020-02-13 16:22:05 +03:00
citus.control Locally execute queries that don't need any data access (#3410) 2020-01-23 18:28:34 +01:00
shared_library_init.c Hide citus.enable_ddl_propagation setting (#3437) 2020-01-29 10:17:53 +01:00