{"id":37088182,"url":"https://github.com/pgspider/griddb_fdw","last_synced_at":"2026-01-14T10:50:03.867Z","repository":{"id":30007048,"uuid":"123509877","full_name":"pgspider/griddb_fdw","owner":"pgspider","description":"GridDB Foreign Data Wrapper for PostgreSQL","archived":false,"fork":false,"pushed_at":"2025-02-10T09:39:35.000Z","size":2339,"stargazers_count":13,"open_issues_count":0,"forks_count":16,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-09-03T12:52:23.247Z","etag":null,"topics":["fdw","foreign-data-wrapper","foreign-tables","griddb","griddb-fdw","postgresql","postgresql-extension"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgspider.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-02T00:42:53.000Z","updated_at":"2025-02-10T09:28:56.000Z","dependencies_parsed_at":"2023-12-20T12:36:48.907Z","dependency_job_id":"37f71231-97b2-4c7c-8d5e-8e1324aedfd6","html_url":"https://github.com/pgspider/griddb_fdw","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/pgspider/griddb_fdw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgspider%2Fgriddb_fdw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgspider%2Fgriddb_fdw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgspider%2Fgriddb_fdw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgspider%2Fgriddb_fdw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgspider","download_url":"https://codeload.github.com/pgspider/griddb_fdw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgspider%2Fgriddb_fdw/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28417716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fdw","foreign-data-wrapper","foreign-tables","griddb","griddb-fdw","postgresql","postgresql-extension"],"created_at":"2026-01-14T10:50:03.217Z","updated_at":"2026-01-14T10:50:03.854Z","avatar_url":"https://github.com/pgspider.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"GridDB Foreign Data Wrapper for PostgreSQL\n==========================================\n\nThis is a foreign data wrapper (FDW) to connect [PostgreSQL](https://www.postgresql.org/)\nto [GridDB](https://github.com/griddb). This FDW works with PostgreSQL 13, 14, 15, 16, 17 and confirmed with GridDB 5.5.0.\n\n\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/2/29/Postgresql_elephant.svg\" align=\"center\" height=\"100\" alt=\"PostgreSQL\"/\u003e\t+\t\u003cimg src=\"https://docs.griddb.net/logo.png\" align=\"center\" height=\"100\" alt=\"GridDB\"/\u003e\n\nContents\n--------\n\n1. [Features](#features)\n2. [Supported platforms](#supported-platforms)\n3. [Installation](#installation)\n4. [Usage](#usage)\n5. [Functions](#functions)\n6. [Identifier case handling](#identifier-case-handling)\n7. [Generated columns](#generated-columns)\n8. [Character set handling](#character-set-handling)\n9. [Examples](#examples)\n10. [Limitations](#limitations)\n11. [Tests](#tests)\n12. [Contributing](#contributing)\n13. [Useful links](#useful-links)\n14. [License](#license)\n\nFeatures\n--------\n### Common features\n\n- Support `SELECT`. For `SELECT`, you can enable partial execution mode as follows: `SET griddbfdw.enable_partial_execution TO TRUE;`\n\n- Support `INSERT`, `DELETE`, `UPDATE`\n\nFor PostgreSQL version 14 or later:\n- Support bulk `INSERT` by using `batch_size` option.\n- Support list cached connections to foreign servers by using function `griddb_get_connection()`.\n- Support discard cached connections to foreign servers by using function `griddb_disconnect('server_name')`, `griddb_disconnect_all()`.\n- Support deparse `ANY`/`ALL ARRAY` with the argument is constant.\n\nFor PostgreSQL version 16 or later:\n- Support Bulk INSERT with COPY command\n\n### Pushdowning\n\n- Support function push down in `WHERE` clause: \n    * Common functions of Postgres and GridDB (same as for PostgreSQL): `char_length`, `concat`, `lower`, `upper`, `substr`, `round`, `ceiling`, `ceil`, `floor`.\n    * Unique function of Griddb: `to_timestamp_ms`, `to_epoch_ms`, `array_length`, `element`, `timestamp`, `timestampadd`, `timestampdiff`, `time_next`, `time_next_only`, `time_prev`, `time_prev_only`, `time_interpolated`, `time_sampling`, `max_rows`, `min_rows`, `now`.\n    * For the push down of `now()` and `timestamp()` function, please add prefix `griddb_` for these functions.\n      Example: `now()` -\u003e `griddb_now()`\n\n- Support `LIMIT...OFFSET` pushdown when having `LIMIT` clause only or both `LIMIT` and `OFFSET`.\n- Support `ORDER BY` pushdown with column, except `ORDER BY column ASC NULLS FIRST`, `ORDER BY column DESC NULLS LAST` and `ORDER BY` functions/formulas\n- Support aggregation push down:\n    * Common functions of Postgres and Griddb are pushed down: `min`, `max`, `count(*)`, `sum`, `avg`, `variance`, `stddev`.\n    * Unique function of Griddb are pushed down: `time_avg`\u003cbr\u003e\n- Support push down `ANY`/`ALL ARRAY` with the argument is constant.\n\n### Notes about features\n\nAlso see [Limitations](#limitations).\n\nSupported platforms\n-------------------\n\n`griddb_fdw` was developed on Linux, and should run on any\nreasonably POSIX-compliant system.\n\nInstallation\n------------\n\n### Source installation\n\nPrerequisites:\n\nGridDB's C client library. This library can be downloaded from the [GridDB](https://github.com/griddb) website on github.\n\n1. Download GridDB's C client and unpack it into `griddb_fdw` directory as griddb.\n    \n    Build GridDB's C client\n    \n    * `gridstore.h` should be in `griddb_fdw/griddb/client/c/include`.\n    * `libgridstore.so` should be in `griddb/bin`.\n\n2. Build and install griddb_fdw\n    \n    Change into the griddb_fdw source directory.\n\u003cpre\u003e\n$ make\n$ make install\n\u003c/pre\u003e\n\nIf you want to build griddb_fdw in a source tree of PostgreSQL, use\n\n\u003cpre\u003e\n$ make NO_PGXS=1\n\u003c/pre\u003e\n\nUsage\n-----\n\n## CREATE SERVER options\n\n`griddb_fdw` accepts the following options via the `CREATE SERVER` command:\n\n- **keep_connections** as *boolean*, optional, default `true`\n\n  Controls whether griddb_fdw keeps the connections to the foreign server open so that the subsequent queries can re-use them. If set to off, all connections to the foreign server will be discarded at the end of transaction. Losed connections will be re-established when they are necessary by future queries using a foreign table.\n\n- **host** as *string*, optional\n\n  GridDB notification address.\n\n- **port** as *interger*, optional\n\n  GridDB notification port.\n\n- **database** as *string*, optional, default `public`\n\n  GridDB database name.\n\n- **clustername** as *string*, optional, no default\n\n  GridDB cluster name.\n  \n- **notification_member** as *string*, optional\n\n  If you want to use fixed list mode instead of multicast mode, you have to specify `notification_member` instead of `host` and `port`:\n`notification_member '10.18.18.18:10001'`\n\n- **updatable** as *boolean*, optional, default `true`\n\n- **batch_size** as *integer*, optional, default `1`\n\n## CREATE USER MAPPING options\n\n`griddb_fdw` accepts the following options via the `CREATE USER MAPPING`\ncommand:\n\n- **username** as *string*, no default\n\n  The griddb username to connect as.\n\n- **password** as *string*, no default\n\n  The griddb user's password.\n\n\n## CREATE FOREIGN TABLE options\n\n`griddb_fdw` accepts the following table-level options via the\n`CREATE FOREIGN TABLE` command.\n\n- **table_name** as *string*, default name of foreign table\n\n- **updatable** as *boolean*, optional, default value comes from similar foreign server option\n\n- **use_remote_estimate** as *boolean*, optional\n\n- **batch_size** as *integer*, optional, default value comes from similar foreign server option\n\n- **fdw_startup_cost** as *interger*, optional\n\n- **fdw_tuple_cost** as *integer*, optional\n\n\nThe following column-level options are available:\n\n- **column_name** as *string*, optional, default name of foreign column\n\n- **rowkey** as *boolean*, optional, default `false`\n\n\n## IMPORT FOREIGN SCHEMA options\n\n`griddb_fdw` supports [IMPORT FOREIGN SCHEMA](https://www.postgresql.org/docs/current/sql-importforeignschema.html)\n(when running with PostgreSQL 9.5 or later) and accepts the following custom options:\n\n- **recreate** as *boolean*, optional, default `false`\n\n  If 'true', table schema will be updated.\n\n\n## TRUNCATE support\n\n`griddb_fdw` yet **don't support** the foreign data wrapper `TRUNCATE` API, available\nfrom PostgreSQL 14.\n\nFunctions\n---------\nAs well as the standard `griddb_fdw_handler()` and `griddb_fdw_validator()`\nfunctions, `griddb_fdw` provides the following user-callable utility functions:\n\n*Functions from this FDW in PostgreSQL catalog are* **yet not described**.\n\n**griddb_get_connection()**\n\n**griddb_disconnect('server_name')**\n\n**griddb_disconnect_all()**\n\nIdentifier case handling\n------------------------\n\nPostgreSQL folds identifiers to lower case by default.\nRules and problems with GridDB identifiers **yet not tested and described**.\n\nGenerated columns\n-----------------\n\nGridDB does not support generated column, so data will be generated at FDW layer.\n`griddb_fdw` supports generated columns in foreign tables based on output of GridDB. Example:\n```sql\n\tCREATE FOREIGN TABLE grem1 (\n  \t  id serial OPTIONS (rowkey 'true'),\n\t  a int,\n\t  b int GENERATED ALWAYS as (a * 2) STORED\n\t)\n\tSERVER griddb_svr \n\tOPTIONS(\n\t  table_name 'gloc1'\n\t);\n```\n\nFor more details on generated columns see:\n\n- [Generated Columns](https://www.postgresql.org/docs/current/ddl-generated-columns.html)\n- [CREATE FOREIGN TABLE](https://www.postgresql.org/docs/current/sql-createforeigntable.html)\n\n\nCharacter set handling\n----------------------\n\n**Yet not described**.\n\nExamples\n--------\n\n### Install the extension:\n\nOnce for a database you need, as PostgreSQL superuser.\n```sql\n\tCREATE EXTENSION griddb_fdw;\n```\n\n### Create a foreign server with appropriate configuration:\n\nOnce for a foreign datasource you need, as PostgreSQL superuser.\n\n```sql\n\tCREATE SERVER griddb_svr\n\tFOREIGN DATA WRAPPER griddb_fdw\n\tOPTIONS(\n\t  host '239.0.0.1',\n\t  port '31999',\n\t  clustername 'ktymCluster',\n\t  database 'public'\n\t);\n```\n\n### Grant usage on foreign server to normal user in PostgreSQL:\n\nOnce for a normal user (non-superuser) in PostgreSQL, as PostgreSQL superuser. It is a good idea to use a superuser only where really necessary, so let's allow a normal user to use the foreign server (this is not required for the example to work, but it's security recomedation).\n\n```sql\n\tGRANT USAGE ON FOREIGN SERVER sqlite_server TO pguser;\n```\nWhere `pguser` is a sample user for works with foreign server (and foreign tables).\n\n### User mapping\n\nCreate an appropriate user mapping:\n```sql\n    \tCREATE USER MAPPING\n\tFOR pguser\n\tSERVER griddb_svr \n    \tOPTIONS (\n\t  username 'username',\n\t  password 'password'\n\t);\n```\nWhere `pguser` is a sample user for works with foreign server (and foreign tables).\n\n### Create foreign table\nAll `CREATE FOREIGN TABLE` SQL commands can be executed as a normal PostgreSQL user if there were correct `GRANT USAGE ON FOREIGN SERVER`. No need PostgreSQL supersuer for security reasons but also works with PostgreSQL supersuer.\n\nCreate a foreign table referencing the griddb table `fdw_test`:\n```sql\n\tCREATE FOREIGN TABLE ft1 (\n\t  c1 text,\n\t  c2 float,\n\t  c3 integer\n\t)\n\tSERVER griddb_svr;\n```\nQuery the foreign table.\n```sql\n\tSELECT * FROM ft1;\n```\nThe **container must have rowkey on GridDB in order to execute update and delete query**.\t\n\n### Import a GridDB schema:\n\n```sql\n\tIMPORT FOREIGN SCHEMA public\n\tFROM SERVER griddb_svr\n\tINTO public\n\tOPTIONS (\n\t  recreate 'true'\n\t);\n```\n\nAfter schema is imported, we can access tables.\nTo use `CREATE FOREIGN TABLE` is not recommended.\n\nLimitations\n-----------\n### SQL commands\n- Record is updated by `INSERT` command if a record with same rowkey as new record exists in GridDB.\nIn this case, `griddb_fdw` raises the warning.\n\n```sql\nINSERT INTO ft1 VALUES(100, 'AAA');\nINSERT INTO ft1 VALUES(100, 'BBB'); -- Same as \"UPDATE ft1 SET b = 'BBB' WHERE a = 100;\"\n```\n- Don't support `ON CONFLICT`. PostgreSQL has upsert (update or insert) feature. When inserting a new row into the table, PostgreSQL will update the row if it already exists, otherwise, PostgreSQL inserts the new row. However, `griddb_fdw` does not support the upsert feature now. For example, it shows an error message if user executes the following query.\n\n```sql\nINSERT INTO ft1(c1, c2) VALUES(11, 12) ON CONFLICT DO NOTHING;\n```\n\n- Don't support `RETURNING`. Returning is way to obtain data if rows are modified by `INSERT`, `UPDATE`, and `DELETE` commands. `griddb_fdw` does not support this feature.\n```sql\nINSERT INTO ft1 (c0, c1) VALUES (1, 2) RETURNING c0, c1;\n```\n- Don't support DIRECT MODIFICATION\n- Don't support push down `LIMIT TO` | `EXCEPT` filter in `IMPORT FOREIGN SCHEMA`. These filters will run locally.\n`griddb_fdw` makes `CREATE FOREIGN TABLE` statements for all existed tables in remote server, and then PostgreSQL's core checks `LIMIT TO` or `EXCEPT` conditions.\n- Don't support `SAVEPOINT`. Savepoint does not work, **warning** is returned.\n\n### Other\n\n- Do not push down `ANY`/`ALL` `ARRAY` with the argument is subquery. \n- GridDB does not support `numeric` data type as PostgreSQL. Therefore, it can not store numbers with too high precision and scale.\n\n#### Limitations related in rowkey-column attribute.\nGridDB can set a rowkey attribute to the 1st column.\n`griddb_fdw` uses it for identifying a record.\n- It is required that a container have the rowkey attribute for executing `UPDATE` or `DELETE`.\n- It is not supported to update a rowkey-column.\n\n\n#### Don't support the query execution which is satisfied with all of following conditions:  \n- It requires to get record locks in a transaction.\n- Records are locked by the other foreign table which links the same container in GridDB.\n\nIf such query is executed, it is no response.\n\nExample1:\nForeign table `ft1` and `ft2` are linked to same container in GridDB.\n\n```sql\nBEGIN;\nSELECT * FROM ft1 FOR UPDATE;\nSELECT * FROM ft2 FOR UPDATE; -- No response\n```\nExample2:\n\n```sql\nBEGIN;\nSELECT * FROM ft1, ft2 WHERE ft1.a = ft2.a FOR UPDATE; -- No response\n```\nThis is because GridDB manages a transaction by container unit and `griddb_fdw` creates GSContainer instances for each foreign tables even if the container is same in GridDB.\n\n#### Don't support an arbitrary column mapping.\n`griddb_fdw` is assumed that a column structure on PostgreSQL is same as that of griddb.\nIt is recommended to create a schema on PostgreSQL by `IMPORT FOREIGN SCHEMA`.\n`griddb_fdw` might return an error when DML is executed.\n\nFor example, container on GridDB has 3 columns. The 1st column is `\"c1\"` as integer, the 2nd is `\"c2\"` as float, and the 3rd is `\"c3\"` as text.\nSchema must be created as\n\n```sql\n\tCREATE FOREIGN TABLE ft1 (\n\t  c1 integer,\n\t  c2 float,\n\t  c3 text \n\t  )\n\tSERVER griddb_svr;\n```\n\nYou should not execute following queries.\n\nTypes are not match.\n\n```sql\n\tCREATE FOREIGN TABLE ft1 (\n\t  c1 text,\n\t  c2 float,\n\t  c3 integer\n\t  )\n\tSERVER griddb_svr;\n```\nThere is unknown column.\nEven if unknown column is dropped, GridDB cannot access `ft1` correctly.\n\n```sql\n\tCREATE FOREIGN TABLE ft1 (\n\t  c0 integer,\n\t  c1 integer,\n\t  c2 float,\n\t  c3 text\n\t  )\n\tSERVER griddb_svr;\n\t\n\tALTER FOREIGN TABLE ft1 DROP COLUMN c0;\n```\n\nTests\n-----\n\nTests for group of PostgreSQL versions are provided. There is no testing for different GridDB versions.\nSee [test.sh](test.sh) and [expected](expected).\n\nContributing\n------------\nOpening issues and pull requests on GitHub are welcome.\n\nUseful links\n------------\n\n### Source code\n\nReference FDW realisation, `postgres_fdw`\n - https://git.postgresql.org/gitweb/?p=postgresql.git;a=tree;f=contrib/postgres_fdw;hb=HEAD\n\n### General FDW Documentation\n\n - https://www.postgresql.org/docs/current/ddl-foreign-data.html\n - https://www.postgresql.org/docs/current/sql-createforeigndatawrapper.html\n - https://www.postgresql.org/docs/current/sql-createforeigntable.html\n - https://www.postgresql.org/docs/current/sql-importforeignschema.html\n - https://www.postgresql.org/docs/current/fdwhandler.html\n - https://www.postgresql.org/docs/current/postgres-fdw.html\n\n### Other FDWs\n\n - https://wiki.postgresql.org/wiki/Fdw\n - https://pgxn.org/tag/fdw/\n \nLicense\n-------\nCopyright (c) 2018, TOSHIBA CORPORATION\nCopyright (c) 2011-2016, EnterpriseDB Corporation\n\nPermission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose, without fee, and without a written agreement is\nhereby granted, provided that the above copyright notice and this paragraph and\nthe following two paragraphs appear in all copies.\n\nSee the [`LICENSE`][1] file for full details.\n\n[1]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgspider%2Fgriddb_fdw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgspider%2Fgriddb_fdw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgspider%2Fgriddb_fdw/lists"}