{"id":29905511,"url":"https://github.com/project-tsurugi/tsurugi_fdw","last_synced_at":"2025-08-01T19:14:21.366Z","repository":{"id":198170295,"uuid":"201157542","full_name":"project-tsurugi/tsurugi_fdw","owner":"project-tsurugi","description":"Tsurugi Foreign Data Wrapper for PostgreSQL.","archived":false,"fork":false,"pushed_at":"2025-07-24T10:19:26.000Z","size":14010,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-24T14:44:31.927Z","etag":null,"topics":["fdw","foreign-data-wrapper","postgresql-extension","postgressql","sql","tsurugidb"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/project-tsurugi.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-08-08T01:53:02.000Z","updated_at":"2025-07-17T06:28:35.000Z","dependencies_parsed_at":"2023-10-04T17:47:16.988Z","dependency_job_id":"fccbbe8d-4c72-404f-8768-c7a7eda3d578","html_url":"https://github.com/project-tsurugi/tsurugi_fdw","commit_stats":null,"previous_names":["project-tsurugi/tsurugi_fdw"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/project-tsurugi/tsurugi_fdw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/project-tsurugi%2Ftsurugi_fdw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/project-tsurugi%2Ftsurugi_fdw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/project-tsurugi%2Ftsurugi_fdw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/project-tsurugi%2Ftsurugi_fdw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/project-tsurugi","download_url":"https://codeload.github.com/project-tsurugi/tsurugi_fdw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/project-tsurugi%2Ftsurugi_fdw/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268282397,"owners_count":24225164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","postgresql-extension","postgressql","sql","tsurugidb"],"created_at":"2025-08-01T19:14:09.566Z","updated_at":"2025-08-01T19:14:21.343Z","avatar_url":"https://github.com/project-tsurugi.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tsurugi_fdw (PostgreSQL add-on)\n\n## Requirements\n\n* C++ Compiler `\u003e= C++17`\n* Source code of PostgreSQL 12/13/14 `\u003e=12.4`, `\u003e=13.18`, `\u003e=14.18`\n* Access to installed dependent modules:\n  * managers ([metadata-manager](https://github.com/project-tsurugi/metadata-manager), [message-manager](https://github.com/project-tsurugi/message-manager))\n  * [takatori](https://github.com/project-tsurugi/takatori)\n  * [ogawayama](https://github.com/project-tsurugi/ogawayama)\n\n## How to build for tsurugi_fdw\n\n1. Install required packages.\n    Install required packages for building tsurugi_fdw.\n    If you already know that the required packages are installed, skip this procedure.\n\n    ```sh\n    sudo apt -y install make gcc g++ git libboost-filesystem-dev\n    ```\n\n1. Build and Install PostgreSQL.\n    tsurugi_fdw uses the PostgreSQL build environment.  \n    If you already know that the environment is set up, skip this procedure.\n    * Specify the PostgreSQL install directory to \"--prefix\". In the following example, $HOME/pgsql is specified.\n    * From now on, this directory is defined as **\\\u003cPostgreSQL install directory\u003e**.\n    * Refer to the PostgreSQL documentation or online manuals for the installation of PostgreSQL.\n\n        ```sh\n        sudo apt -y install curl bzip2 libreadline-dev libz-dev\n        ```\n\n    ```sh\n    curl -sL https://ftp.postgresql.org/pub/source/v12.4/postgresql-12.4.tar.bz2 | tar -xj\n    cd postgresql-12.4\n    ./configure --prefix=$HOME/pgsql\n    make\n    make install\n    ```\n\n1. Clone tsurugi_fdw.\n    Clone tsurugi_fdw to \"contrib\" directory in PostgreSQL.\n    * From now on, this directory is defined as **\\\u003ctsurugi_fdw clone directory\u003e**.\n\n    ```sh\n    cd contrib\n    git clone git@github.com:project-tsurugi/tsurugi_fdw.git\n    cd tsurugi_fdw\n    git submodule update --init --recursive\n    ```\n\n1. Install libraries required to build dependent modules.\n\n    ```sh\n    # Common dependency library for each dependent module.\n    sudo apt -y install build-essential cmake ninja-build\n    # Dependency libraries for takarori.\n    sudo apt -y install libboost-container-dev libboost-stacktrace-dev libicu-dev flex bison\n    # Dependency libraries for metadata-manager.\n    sudo apt -y install libssl-dev\n    # Dependency libraries for ogawayama(stub).\n    sudo apt -y install libboost-thread-dev libgoogle-glog-dev libprotobuf-dev protobuf-compiler\n    ```\n\n    For libraries required, refer to README of each dependent module.\n\n1. Build and Install dependent modules.\n\n    ```sh\n    make install_dependencies\n    ```\n\n    If tsurugi_fdw was cloned into a directory other than the \"contrib\" directory in PostgreSQL,\n    add a directory of pg_config to PATH and use \"USE_PGXS=1\".\n\n    ```sh\n    make install_dependencies USE_PGXS=1\n    ```\n\n    Dependent modules installed in **\\\u003cPostgreSQL install directory\u003e**.  \n\n1. Add **\\\u003cPostgreSQL install directory\u003e** to LIBRARY_PATH.\n\n    ```sh\n    export LIBRARY_PATH=$LIBRARY_PATH:\u003cPostgreSQL install directory\u003e/lib\n    ```\n\n1. Build and Install tsurugi_fdw.\n\n    ```sh\n    make\n    make install\n    ```\n\n    If tsurugi_fdw was cloned into a directory other than the \"contrib\" directory in PostgreSQL,\n    add a directory of pg_config to PATH and use \"USE_PGXS=1\".\n\n    ```sh\n    make USE_PGXS=1\n    make install USE_PGXS=1\n    ```\n\n## How to set up for tsurugi_fdw\n\n1. Create PostgreSQL server.\n\n    ```sh\n    mkdir \u003cPostgreSQL install directory\u003e/data\n    initdb -D \u003cPostgreSQL install directory\u003e/data\n    ```\n\n1. Update **shared_preload_libraries** parameter in postgresql.conf as below.\n    * postgresql.conf exists in **\\\u003cPostgreSQL install directory\u003e/data/**.\n\n    ```conf\n    shared_preload_libraries = 'tsurugi_fdw'\n    ```\n\n1. Start PostgreSQL.\n\n    ```sh\n    pg_ctl -D \u003cPostgreSQL install directory\u003e/data/ start\n    ```\n\n1. Install tsurugi_fdw extension\n    * Execute **CREATE EXTENSION** command\n\n        ```sql\n        CREATE EXTENSION tsurugi_fdw;\n        ```\n\n    * Check with the meta-command(\\dew)\n\n        ```sql\n        postgres=# \\dew\n                        List of foreign-data wrappers\n                Name      |  Owner   |        Handler        | Validator\n           ---------------+----------+-----------------------+-----------\n            tsurugi_fdw   | postgres | tsurugi_fdw_handler   | -\n        ```\n\n1. Define external-server\n\n   * Execute **CREATE SERVER** command\n\n        ```sql\n        CREATE SERVER tsurugi FOREIGN DATA WRAPPER tsurugi_fdw;\n        ```\n\n   * Check with the meta-command(\\des)\n\n        ```sql\n        postgres=# \\des\n                    List of foreign servers\n            Name    |  Owner   | Foreign-data wrapper\n         -----------+----------+----------------------\n          tsurugi   | postgres | tsurugi_fdw\n        ```\n\n## Regression tests\n\n### Structure\n\n* **expected/** test results expectations\n* **results/** test results\n* **sql/** all the tests\n\n### How to execute the tests\n\n1. Start Tsurugi Server\n    * Refer to the Tsurugi documentation on how to start the Tsurugi server.\n\n1. Build tsurugi_fdw\n   * [How to build for tsurugi_fdw](#how-to-build-for-tsurugi_fdw)\n\n1. Set up tsurugi_fdw\n   * [How to set up for tsurugi_fdw](#how-to-set-up-for-tsurugi_fdw)\n\n1. Execute the following command\n\n    in case when you run only basic tests\n\n    ```sh\n    make tests\n    ```\n\n    Or in case when run extra tests with basic tests,  \n    execute the following command:\n\n    ```sh\n    make tests REGRESS_EXTRA=1\n    ```\n\n    If tsurugi_fdw was cloned into a directory other than the \"contrib\" directory in PostgreSQL,\n    add a directory of pg_config to PATH and use \"USE_PGXS=1\".\n\n    ```sh\n    make tests USE_PGXS=1\n    ```\n\n## How to access Tsurugi from PostgreSQL\n\n1. Define foreign table\n   * Execute **CREATE FOREIGN TABLE** command\n     * You must define same table name as table name in Tsurugi\n     * You must specify same server name as specified in CREATE SERVER\n\n        ```sql\n        CREATE FOREIGN TABLE table1 (column1 INTEGER NOT NULL) SERVER tsurugi;\n        ```\n\n1. Execute DML\n\n    ```sql\n    SELECT * FROM table1;\n    INSERT INTO table1 (column1) VALUES (100);\n    ```\n\n\u003e [!NOTE]\n\u003e see [docs/setup.md](./docs/setup.md) and [docs/tutorial.md](./docs/tutorial.md), it has more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproject-tsurugi%2Ftsurugi_fdw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproject-tsurugi%2Ftsurugi_fdw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproject-tsurugi%2Ftsurugi_fdw/lists"}