diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-02-03 09:01:59 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-02-03 09:07:35 -0500 |
commit | dc203dc3ac40a4b02b92fb827848a547d2957153 (patch) | |
tree | 3dfb165d3fc356f6fb847f16b2590805c0c54bd4 /contrib/postgres_fdw/option.c | |
parent | e6ecc93a1747624c4d33fa48d8a2d77319f3400f (diff) | |
download | postgresql-dc203dc3ac40a4b02b92fb827848a547d2957153.tar.gz postgresql-dc203dc3ac40a4b02b92fb827848a547d2957153.zip |
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.
Diffstat (limited to 'contrib/postgres_fdw/option.c')
-rw-r--r-- | contrib/postgres_fdw/option.c | 14 |
1 files changed, 14 insertions, 0 deletions
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} }; |