Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

rds_hwdrs_privs

Updated on 2024-10-14 GMT+08:00

Introduction

The rds_hwdrs_privs extension is used to escalate root privileges for some RDS for PostgreSQL versions, including:

  • Granting the SELECT permission on pg_catalog.pg_authid
  • Granting the BYPASSRLS and REPLICATION permissions
  • Granting the permissions required to create a publication for ALL TABLES
  • Granting the permissions required to execute some pg_replication_origin_xxx functions

Supported Versions

This extension is available to RDS for PostgreSQL 9.5 to 15. This extension is used to escalate root privileges for RDS for PostgreSQL 9.5, 9.6, 10, 11.5, and earlier versions. For versions later than 11.5, you can perform operations granted by this extension as user root directly.

You can run the following SQL statement to check whether your DB instance supports this extension:

SELECT * FROM pg_available_extension_versions WHERE name = 'rds_hwdrs_privs';

To see more extensions supported by RDS for PostgreSQL, go to Supported Extensions.

Extension Installation and Uninstallation

  • Installing the extension
    SELECT control_extension ('create', 'rds_hwdrs_privs');
  • Uninstalling the extension
    SELECT control_extension ('drop', 'rds_hwdrs_privs');

For more information, see Installing and Uninstalling an Extension on the RDS Console and Installing and Uninstalling an Extension Using SQL Commands.

How to Use

This extension can be used only by user root or a member user of user root.

You can directly perform operations as user root or grant root permissions to another user (for example, drs_sync) by running the following command:

grant root to drs_sync;

and use user drs_sync to perform operations.

  • Granting a user the SELECT permission on pg_catalog.pg_authid
    select control_select_on_pg_authid('grant', 'drs_sync');

    The first parameter can be grant or revoke. The second parameter indicates a specific user, which must have been created.

  • Granting the BYPASSRLS and REPLICATION permissions to a user

    select control_user_privilege('bypassrls', 'drs_sync');

    The first parameter indicates the permission to be assigned. The options are BYPASSRLS, NOBYPASSRLS, REPLICATION, and NOREPLICATION. The second parameter indicates a specific user, which must have been created.

  • Granting the permissions required to create a publication for all tables
    select create_publication_for_all_tables('foo_pub', 'insert, update');
    select create_publication_for_all_tables('foo_pub');
    NOTE:

    This function creates only a publication for all tables. You can use SQL statements to create a publication for a specific table.

    The first parameter is the publication name, which must be different from any existing publication name. The second parameter indicates which DML operations will be published by the new publication to the subscribers. By default, the value is the same as that of create publication foo_pub for all tables. In RDS for PostgreSQL 10, the allowed operations are insert, update, and delete. In RDS for PostgreSQL 11, truncate is also supported.

    The owner of the new publication is root. You can perform subsequent operations on the publication using SQL statements as root or a member user of root.

  • Granting the permissions required to execute some pg_replication_origin_xxx functions
    -- Creating a replication origin
    select exec_pg_replication_origin_func('pg_replication_origin_create', 'foo_repl_origin');
    -- Deleting a replication origin
    select exec_pg_replication_origin_func('pg_replication_origin_create', 'foo_repl_origin');
    -- Checking whether the current session is bound to a replication origin
    select exec_pg_replication_origin_func('pg_replication_origin_session_is_setup');

    The first parameter indicates the name of the function to be executed. The options are pg_replication_origin_create, pg_replication_origin_drop, pg_replication_origin_oid, pg_replication_origin_session_setup, pg_replication_origin_session_reset, and pg_replication_origin_session_is_setup. The second parameter can be left blank. Whether the second parameter is left blank depends on whether the function to be executed requires a parameter value.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback