Skip to content

Commit

Permalink
Document unusable PostgreSQL versions
Browse files Browse the repository at this point in the history
An API break in PostgreSQL 10.4 and 9.6.9 makes it impossible
to use these versions: the "extract_actual_join_clauses" function
gained an additional parameter.

Document and add a safeguard to _PG_init.

Noticed by Francesco Pirotti in #272.
  • Loading branch information
laurenz committed Sep 7, 2018
1 parent 752048a commit d137d15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.oracle_fdw
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ PostgreSQL 9.1 or better is required.
Support for ANALYZE is available from PostgreSQL 9.2 on.
Support for INSERT, UPDATE and DELETE is available from PostgreSQL 9.3 on.

Due to an API break in a PostgreSQL minor release, the following PostgreSQL
versions cannot be used: 9.6.0 to 9.6.8 and 10.0 to 10.3

oracle_fdw is written for standard open source PostgreSQL.
Forks of PostgreSQL, such as "PostgresPro" and "Postgres-XL", are likely to
be incompatible.
Expand Down
14 changes: 14 additions & 0 deletions oracle_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,20 @@ oracle_diag(PG_FUNCTION_ARGS)
void
_PG_init(void)
{
/* check for incompatible server versions */
char *pgver_str = GetConfigOptionByName("server_version_num", NULL);
long pgver = strtol(pgver_str, NULL, 10);

pfree(pgver_str);

if ((pgver >= 90600 && pgver <= 90608)
|| (pgver >= 100000 && pgver <= 100003))
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
errmsg("PostgreSQL version \"%s\" not supported by oracle_fdw",
GetConfigOptionByName("server_version", NULL)),
errhint("You'll have to update PostgreSQL to a later minor release.")));

/* register an exit hook */
on_proc_exit(&exitHook, PointerGetDatum(NULL));
}
Expand Down

0 comments on commit d137d15

Please sign in to comment.