From dc203dc3ac40a4b02b92fb827848a547d2957153 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Wed, 3 Feb 2016 09:01:59 -0500 Subject: postgres_fdw: Allow fetch_size to be set per-table or per-server. The default fetch size of 100 rows might not be right in every environment, so allow users to configure it. Corey Huinker, reviewed by Kyotaro Horiguchi, Andres Freund, and me. --- contrib/postgres_fdw/option.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'contrib/postgres_fdw/option.c') diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c index 86a57890fc0..f89de2f6947 100644 --- a/contrib/postgres_fdw/option.c +++ b/contrib/postgres_fdw/option.c @@ -131,6 +131,17 @@ postgres_fdw_validator(PG_FUNCTION_ARGS) /* check list syntax, warn about uninstalled extensions */ (void) ExtractExtensionList(defGetString(def), true); } + else if (strcmp(def->defname, "fetch_size") == 0) + { + int fetch_size; + + fetch_size = strtol(defGetString(def), NULL,10); + if (fetch_size <= 0) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("%s requires a non-negative integer value", + def->defname))); + } } PG_RETURN_VOID(); @@ -162,6 +173,9 @@ InitPgFdwOptions(void) /* updatable is available on both server and table */ {"updatable", ForeignServerRelationId, false}, {"updatable", ForeignTableRelationId, false}, + /* fetch_size is available on both server and table */ + {"fetch_size", ForeignServerRelationId, false}, + {"fetch_size", ForeignTableRelationId, false}, {NULL, InvalidOid, false} }; -- cgit v1.2.3