{"id":14063368,"url":"https://github.com/aiven/aiven-extras","last_synced_at":"2025-08-23T01:07:43.812Z","repository":{"id":37703544,"uuid":"143978929","full_name":"aiven/aiven-extras","owner":"aiven","description":"Aiven PostgreSQL® extras","archived":false,"fork":false,"pushed_at":"2025-04-30T08:13:29.000Z","size":140,"stargazers_count":19,"open_issues_count":7,"forks_count":8,"subscribers_count":75,"default_branch":"main","last_synced_at":"2025-04-30T09:28:11.547Z","etag":null,"topics":["aiven","postgresql"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","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/aiven.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-08T07:44:22.000Z","updated_at":"2025-04-12T08:55:20.000Z","dependencies_parsed_at":"2024-02-22T10:39:58.298Z","dependency_job_id":"3c063816-19b5-49b7-b906-7fe603905353","html_url":"https://github.com/aiven/aiven-extras","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/aiven/aiven-extras","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiven%2Faiven-extras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiven%2Faiven-extras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiven%2Faiven-extras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiven%2Faiven-extras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiven","download_url":"https://codeload.github.com/aiven/aiven-extras/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiven%2Faiven-extras/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271727586,"owners_count":24810561,"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-22T02:00:08.480Z","response_time":65,"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":["aiven","postgresql"],"created_at":"2024-08-13T07:03:18.262Z","updated_at":"2025-08-23T01:07:43.780Z","avatar_url":"https://github.com/aiven.png","language":"PLpgSQL","funding_links":[],"categories":["PLpgSQL"],"sub_categories":[],"readme":"aiven-extras\n============\n\nThis extension is meant for use in enviroments where you want non-superusers to be able\nto use certain database features, such as creating logical replication connections using PostgreSQL® 10+'s logical replications\nSUBSCRIPTION/PUBLICATION concepts or configuring the `auto_explain` extension.\n\nIt allows you to use logical replication when installed originally by root and the\nuser using it has the REPLICATION privilege.\n\nPlease note that when loading the `auto_explain` extension, it is loaded for the current session only.\n\nInstallation\n============\n\nTo create the Aiven extras extension, run the following after connecting to the database you wish to enable it in:\n\n```sql\n$ CREATE EXTENSION aiven_extras;\nCREATE EXTENSION\n```\n\nUsage\n=====\n\n*The functions included are:*\n\n|                   Name                    |               Result data type               |                                                                               Argument data types                                                                                |\n|-------------------------------------------|----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| auto_explain_load                         | void                                         |                                                                                                                                                                                  |\n| claim_public_schema_ownership             | void                                         |                                                                                                                                                                                  |\n| dblink_record_execute                     | SETOF record                                 | text, text                                                                                                                                                                       |\n| dblink_slot_create_or_drop                | void                                         | arg_connection_string text, arg_slot_name text, arg_action text                                                                                                                  |\n| explain_statement                         | SETOF json                                   | arg_query text                                                                                                                                                                   |\n| pg_alter_subscription_disable             | void                                         | arg_subscription_name text                                                                                                                                                       |\n| pg_alter_subscription_enable              | void                                         | arg_subscription_name text                                                                                                                                                       |\n| pg_alter_subscription_refresh_publication | void                                         | arg_subscription_name text, arg_copy_data boolean DEFAULT true                                                                                                                   |\n| pg_create_publication                     | void                                         | arg_publication_name text, arg_publish text, VARIADIC arg_tables text[] DEFAULT ARRAY[]::text[]                                                                                  |\n| pg_create_publication_for_all_tables      | void                                         | arg_publication_name text, arg_publish text                                                                                                                                      |\n| pg_create_subscription                    | void                                         | arg_subscription_name text, arg_connection_string text, arg_publication_name text, arg_slot_name text, arg_slot_create boolean DEFAULT false, arg_copy_data boolean DEFAULT true |\n| pg_drop_subscription                      | void                                         | arg_subscription_name text                                                                                                                                                       |\n| pg_list_all_subscriptions                 | SETOF aiven_extras.aiven_pg_subscription     |                                                                                                                                                                                  |\n| pg_stat_replication_list                  | SETOF aiven_extras.aiven_pg_stat_replication |                                                                                                                                                                                  |\n| session_replication_role                  | text                                         | arg_parameter text                                                                                                                                                               |\n| set_auto_explain_log_analyze              | text                                         | arg_parameter text                                                                                                                                                               |\n| set_auto_explain_log_buffers              | text                                         | arg_parameter text                                                                                                                                                               |\n| set_auto_explain_log_format               | text                                         | arg_parameter text                                                                                                                                                               |\n| set_auto_explain_log_min_duration         | text                                         | arg_parameter text                                                                                                                                                               |\n| set_auto_explain_log_nested_statements    | text                                         | arg_parameter text                                                                                                                                                               |\n| set_auto_explain_log_timing               | text                                         | arg_parameter text                                                                                                                                                               |\n| set_auto_explain_log_verbose              | text                                         | arg_parameter text                                                                                                                                                               |\n| set_pgaudit_parameter                     | void                                         | arg_parameter text, arg_database text, arg_value text                                                                                                                            |\n| set_pgaudit_role_parameter                | void                                         | arg_parameter text, arg_role text, arg_value text                                                                                                                                |\n\nExamples\n--------\n\n**Managing subscriptions:**\n\n```sql\n-- Create a new subscription\nSELECT * FROM aiven_extras.pg_create_subscription(\n    'subscription',\n    'dbname=defaultdb host=destination-demoprj.aivencloud.com port=26882 sslmode=require user=avnadmin password=secret',\n    'pub1',\n    'slot',\n    TRUE,\n    TRUE\n);\n\n-- List all subscriptions\nSELECT * FROM aiven_extras.pg_list_all_subscriptions();\n\n-- Drop a subscription\nSELECT * FROM aiven_extras.pg_drop_subscription('subscription');\n\n-- Create a publication `pub1` with `publish='INSERT,UPDATE'` for tables `foo` and `bar`\n-- (Note: use fully qualified names)\nSELECT * FROM aiven_extras.pg_create_publication('pub1', 'INSERT,UPDATE', 'public.foo', 'public.bar');\n\n-- Create a publication `pub2` with `publish='INSERT'` for all tables\nSELECT * FROM aiven_extras.pg_create_publication_for_all_tables('pub2', 'INSERT');\n\n-- Disable a subscription\nSELECT * FROM aiven_extras.pg_alter_subscription_disable('subscription');\n\n-- Enable a subscription\nSELECT * FROM aiven_extras.pg_alter_subscription_enable('subscription');\n\n-- Refresh a subscribed publication with `copy_data` set to FALSE\nSELECT * FROM aiven_extras.pg_alter_subscription_refresh_publication('subscription', FALSE);\n```\n\n**Configuring auto-explain:**\n\nFor details, refer to [PostgreSQL's documentation](https://www.postgresql.org/docs/current/auto-explain.html), but note that arguments for the exposed functions are of type `text`. Also note that currently `aiven_extras` implements a subset of the available functions.\n\n```sql\n-- Load the extension for the current session\nSELECT * FROM aiven_extras.auto_explain_load();\n\n-- Set minimum duration to 2000 ms\nSELECT * FROM aiven_extras.set_auto_explain_log_min_duration('2000');\n\n-- Enable ANALYZE\nSELECT * FROM aiven_extras.set_auto_explain_log_analyze('on');\n```\n\nLicense\n=======\n\nAiven extras Extension is licensed under the Apache License, Version 2.0. Full license text\nis available in the ``LICENSE`` file and at http://www.apache.org/licenses/LICENSE-2.0.txt\n\n\nCredits\n=======\n\nAiven extras extension was created by Hannu Valtonen \u003channu.valtonen@aiven.io\u003e for\n`Aiven Cloud Database` and is now maintained by Aiven developers.\n\n`Aiven Cloud Database`: https://aiven.io/\n\nRecent contributors are listed on the GitHub project page,\nhttps://github.com/aiven/aiven-extras/graphs/contributors\n\n\nContact\n=======\n\nBug reports and patches are very welcome, please post them as GitHub issues\nand pull requests at https://github.com/aiven/aiven-extras . Any possible\nvulnerabilities or other serious issues should be reported directly to the\nmaintainers \u003copensource@aiven.io\u003e.\n\n\nTrademarks\n==========\n\nPostgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.\n\n\nCopyright\n=========\n\nCopyright (C) 2018 Aiven Ltd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiven%2Faiven-extras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiven%2Faiven-extras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiven%2Faiven-extras/lists"}