citusdata / citusdata/pg_shard
postgres_fdw does not work when pg_shard is on shared_preload_libraries
- Dominant language
- C
- Stars
- 1.1k
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
@samay-sharma discovered that postgres_fdw does not work when shared_preload_libraries is set to 'pg_shard'.
When the instructions on this [link](https://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.3#postgres_fdw) is followed for postgres_fdw, we get the following error on _INSERT_ statements to postgres_fdw table:
``` sql
WARNING: Connection failed to ~�:30098872
DETAIL: Remote message: invalid port number: "30098872"
ERROR: connection pointer is NULL
```
The root of the problem seems to be about linking/loading of shared libraries. postgres_fdw extension calls a function [_GetConnection()_](https://github.com/commandprompt/postgres_fdw/blob/master/connection.c#L90) in somewhere in the code. However, since pg_shard is also loaded, pg_shard's [_GetConnection()_](https://github.com/citusdata/pg_shard/blob/develop/connection.c#L60) function is called.
We might consider this [comment](https://github.com/citusdata/pg_shard/blob/develop/Makefile#L16) in the Makefile.
Also note that, call to [_DeterminePlannerType()_](https://github.com/citusdata/pg_shard/blob/develop/pg_shard.c#L228), returns _PLANNER_TYPE_POSTGRES_, and [_standard_planner()_](https://github.com/citusdata/pg_shard/blob/develop/pg_shard.c#L321) is called. This error is thrown after _standard_planner()_ is called.
Contributor guide
Assessment
This issue has not been assessed yet.