- About MogDB
- Quick Start
- MogDB Playground
- Container-based MogDB Installation
- Installation on a Single Node
- MogDB Access
- Use CLI to Access MogDB
- Use GUI to Access MogDB
- Use Middleware to Access MogDB
- Use Programming Language to Access MogDB
- Using Sample Dataset Mogila
- Characteristic Description
- Overview
- High Performance
- CBO Optimizer
- LLVM
- Vectorized Engine
- Hybrid Row-Column Store
- Adaptive Compression
- SQL by pass
- Kunpeng NUMA Architecture Optimization
- High Concurrency of Thread Pools
- SMP for Parallel Execution
- Xlog no Lock Flush
- Parallel Page-based Redo For Ustore
- Row-Store Execution to Vectorized Execution
- Astore Row Level Compression
- BTree Index Compression
- Tracing SQL Function
- Parallel Index Scan
- Enhancement of Tracing Backend Key Thread
- Ordering Operator Optimization
- High Availability (HA)
- Primary/Standby
- Logical Replication
- Logical Backup
- Physical Backup
- Automatic Job Retry upon Failure
- Ultimate RTO
- High Availability Based on the Paxos Protocol
- Cascaded Standby Server
- Delayed Replay
- Adding or Deleting a Standby Server
- Delaying Entering the Maximum Availability Mode
- Parallel Logical Decoding
- DCF
- CM(Cluster Manager)
- Global SysCache
- Using a Standby Node to Build a Standby Node
- Two City and Three Center DR
- CM Cluster Management Component Supporting Two Node Deployment
- Maintainability
- Database Security
- Access Control Model
- Separation of Control and Access Permissions
- Database Encryption Authentication
- Data Encryption and Storage
- Database Audit
- Network Communication Security
- Resource Label
- Unified Audit
- Dynamic Data Anonymization
- Row-Level Access Control
- Password Strength Verification
- Equality Query in a Fully-encrypted Database
- Ledger Database Mechanism
- Transparent Data Encryption
- Enterprise-Level Features
- Support for Functions and Stored Procedures
- SQL Hints
- Full-Text Indexing
- Copy Interface for Error Tolerance
- Partitioning
- Support for Advanced Analysis Functions
- Materialized View
- HyperLogLog
- Creating an Index Online
- Autonomous Transaction
- Global Temporary Table
- Pseudocolumn ROWNUM
- Stored Procedure Debugging
- JDBC Client Load Balancing and Read/Write Isolation
- In-place Update Storage Engine
- Publication-Subscription
- Foreign Key Lock Enhancement
- Data Compression in OLTP Scenarios
- Transaction Async Submit
- Index Creation Parallel Control
- Dynamic Partition Pruning
- COPY Import Optimization
- SQL Running Status Observation
- BRIN Index
- BLOOM Index
- Application Development Interfaces
- AI Capabilities
- AI4DB: Autonomous Database O&M
- DB4AI: Database-driven AI
- AI in DB
- ABO Optimizer
- Middleware
- Installation Guide
- Installation Preparation
- Container Installation
- PTK-based Installation
- OM-based Installation
- Manual Installation
- Recommended Parameter Settings
- Administrator Guide
- Localization
- Routine Maintenance
- Starting and Stopping MogDB
- Using the gsql Client for Connection
- Routine Maintenance
- Checking OS Parameters
- Checking MogDB Health Status
- Checking Database Performance
- Checking and Deleting Logs
- Checking Time Consistency
- Checking The Number of Application Connections
- Routinely Maintaining Tables
- Routinely Recreating an Index
- Exporting and Viewing the WDR
- Data Security Maintenance Suggestions
- Slow SQL Diagnosis
- Log Reference
- Primary and Standby Management
- MOT Engine
- Introducing MOT
- Using MOT
- Concepts of MOT
- Appendix
- Column-store Tables Management
- Backup and Restoration
- Two City and Three Center DR
- Importing and Exporting Data
- Importing Data
- Exporting Data
- Upgrade Guide
- AI Features Guide
- AI Features Overview
- AI4DB: Autonomous Database O&M
- DBMind Mode
- Components that Support DBMind
- AI Sub-functions of the DBMind
- X-Tuner: Parameter Tuning and Diagnosis
- Index-advisor: Index Recommendation
- Slow Query Diagnosis: Root Cause Analysis for Slow SQL Statements
- Forecast: Trend Prediction
- SQLdiag: Slow SQL Discovery
- SQL Rewriter
- Anomaly Detection
- DB4AI: Database-driven AI
- AI in DB
- Intelligence Explain: SQL Statement Query Time Prediction
- ABO Optimizer
- Intelligent Cardinality Estimation
- Adaptive Plan Selection
- Security Guide
- Developer Guide
- Application Development Guide
- Development Specifications
- Development Based on JDBC
- Overview
- JDBC Package, Driver Class, and Environment Class
- Development Process
- Loading the Driver
- Connecting to a Database
- Connecting to the Database (Using SSL)
- Connecting to the Database (Using UDS)
- Running SQL Statements
- Processing Data in a Result Set
- Closing a Connection
- Managing Logs
- Example: Common Operations
- Example: Retrying SQL Queries for Applications
- Example: Importing and Exporting Data Through Local Files
- Example 2: Migrating Data from a MY Database to MogDB
- Example: Logic Replication Code
- Example: Parameters for Connecting to the Database in Different Scenarios
- JDBC API Reference
- java.sql.Connection
- java.sql.CallableStatement
- java.sql.DatabaseMetaData
- java.sql.Driver
- java.sql.PreparedStatement
- java.sql.ResultSet
- java.sql.ResultSetMetaData
- java.sql.Statement
- javax.sql.ConnectionPoolDataSource
- javax.sql.DataSource
- javax.sql.PooledConnection
- javax.naming.Context
- javax.naming.spi.InitialContextFactory
- CopyManager
- JDBC-based Common Parameter Reference
- Development Based on ODBC
- Development Based on libpq
- Dependent Header Files of libpq
- Development Process
- Example
- Link Parameters
- libpq API Reference
- Database Connection Control Functions
- Database Statement Execution Functions
- Functions for Asynchronous Command Processing
- Functions for Canceling Queries in Progress
- Psycopg-Based Development
- Commissioning
- Stored Procedure
- User Defined Functions
- PL/pgSQL-SQL Procedural Language
- Scheduled Jobs
- Autonomous Transaction
- Logical Replication
- Extension
- Materialized View
- Materialized View Overview
- Full Materialized View
- Incremental Materialized View
- Partition Management
- Partition Pruning
- Recommendations For Choosing A Partitioning Strategy
- Application Development Guide
- Performance Tuning Guide
- System Optimization
- SQL Optimization
- WDR Snapshot
- Using the Vectorized Executor for Tuning
- TPC-C Performance Tunning Guide
- Reference Guide
- System Catalogs and System Views
- Overview of System Catalogs and System Views
- System Catalogs
- GS_ASP
- GS_AUDITING_POLICY
- GS_AUDITING_POLICY_ACCESS
- GS_AUDITING_POLICY_FILTERS
- GS_AUDITING_POLICY_PRIVILEGES
- GS_CLIENT_GLOBAL_KEYS
- GS_CLIENT_GLOBAL_KEYS_ARGS
- GS_COLUMN_KEYS
- GS_COLUMN_KEYS_ARGS
- GS_DB_PRIVILEGE
- GS_ENCRYPTED_COLUMNS
- GS_ENCRYPTED_PROC
- GS_GLOBAL_CHAIN
- GS_GLOBAL_CONFIG
- GS_MASKING_POLICY
- GS_MASKING_POLICY_ACTIONS
- GS_MASKING_POLICY_FILTERS
- GS_MATVIEW
- GS_MATVIEW_DEPENDENCY
- GS_MODEL_WAREHOUSE
- GS_OPT_MODEL
- GS_PACKAGE
- GS_POLICY_LABEL
- GS_RECYCLEBIN
- GS_TXN_SNAPSHOT
- GS_UID
- GS_WLM_EC_OPERATOR_INFO
- GS_WLM_INSTANCE_HISTORY
- GS_WLM_OPERATOR_INFO
- GS_WLM_PLAN_ENCODING_TABLE
- GS_WLM_PLAN_OPERATOR_INFO
- GS_WLM_SESSION_QUERY_INFO_ALL
- GS_WLM_USER_RESOURCE_HISTORY
- PG_AGGREGATE
- PG_AM
- PG_AMOP
- PG_AMPROC
- PG_APP_WORKLOADGROUP_MAPPING
- PG_ATTRDEF
- PG_ATTRIBUTE
- PG_AUTH_HISTORY
- PG_AUTH_MEMBERS
- PG_AUTHID
- PG_CAST
- PG_CLASS
- PG_COLLATION
- PG_CONSTRAINT
- PG_CONVERSION
- PG_DATABASE
- PG_DB_ROLE_SETTING
- PG_DEFAULT_ACL
- PG_DEPEND
- PG_DESCRIPTION
- PG_DIRECTORY
- PG_ENUM
- PG_EXTENSION
- PG_EXTENSION_DATA_SOURCE
- PG_FOREIGN_DATA_WRAPPER
- PG_FOREIGN_SERVER
- PG_FOREIGN_TABLE
- PG_HASHBUCKET
- PG_INDEX
- PG_INHERITS
- PG_JOB
- PG_JOB_PROC
- PG_LANGUAGE
- PG_LARGEOBJECT
- PG_LARGEOBJECT_METADATA
- PG_NAMESPACE
- PG_OBJECT
- PG_OPCLASS
- PG_OPERATOR
- PG_OPFAMILY
- PG_PARTITION
- PG_PLTEMPLATE
- PG_PROC
- PG_PUBLICATION
- PG_PUBLICATION_REL
- PG_RANGE
- PG_REPLICATION_ORIGIN
- PG_RESOURCE_POOL
- PG_REWRITE
- PG_RLSPOLICY
- PG_SECLABEL
- PG_SET
- PG_SHDEPEND
- PG_SHDESCRIPTION
- PG_SHSECLABEL
- PG_STATISTIC
- PG_STATISTIC_EXT
- PG_SUBSCRIPTION
- PG_SYNONYM
- PG_TABLESPACE
- PG_TRIGGER
- PG_TS_CONFIG
- PG_TS_CONFIG_MAP
- PG_TS_DICT
- PG_TS_PARSER
- PG_TS_TEMPLATE
- PG_TYPE
- PG_USER_MAPPING
- PG_USER_STATUS
- PG_WORKLOAD_GROUP
- PGXC_CLASS
- PGXC_GROUP
- PGXC_NODE
- PGXC_SLICE
- PLAN_TABLE_DATA
- STATEMENT_HISTORY
- System Views
- DV_SESSION_LONGOPS
- DV_SESSIONS
- GET_GLOBAL_PREPARED_XACTS(Discarded)
- GS_AUDITING
- GS_AUDITING_ACCESS
- GS_AUDITING_PRIVILEGE
- GS_ASYNC_SUBMIT_SESSIONS_STATUS
- GS_CLUSTER_RESOURCE_INFO
- GS_COMPRESSION
- GS_DB_PRIVILEGES
- GS_FILE_STAT
- GS_GSC_MEMORY_DETAIL
- GS_INSTANCE_TIME
- GS_LABELS
- GS_LSC_MEMORY_DETAIL
- GS_MASKING
- GS_MATVIEWS
- GS_OS_RUN_INFO
- GS_REDO_STAT
- GS_SESSION_CPU_STATISTICS
- GS_SESSION_MEMORY
- GS_SESSION_MEMORY_CONTEXT
- GS_SESSION_MEMORY_DETAIL
- GS_SESSION_MEMORY_STATISTICS
- GS_SESSION_STAT
- GS_SESSION_TIME
- GS_SQL_COUNT
- GS_STAT_SESSION_CU
- GS_THREAD_MEMORY_CONTEXT
- GS_TOTAL_MEMORY_DETAIL
- GS_WLM_CGROUP_INFO
- GS_WLM_EC_OPERATOR_STATISTICS
- GS_WLM_OPERATOR_HISTORY
- GS_WLM_OPERATOR_STATISTICS
- GS_WLM_PLAN_OPERATOR_HISTORY
- GS_WLM_REBUILD_USER_RESOURCE_POOL
- GS_WLM_RESOURCE_POOL
- GS_WLM_SESSION_HISTORY
- GS_WLM_SESSION_INFO
- GS_WLM_SESSION_INFO_ALL
- GS_WLM_SESSION_STATISTICS
- GS_WLM_USER_INFO
- GS_WRITE_TERM_LOG
- MPP_TABLES
- PG_AVAILABLE_EXTENSION_VERSIONS
- PG_AVAILABLE_EXTENSIONS
- PG_COMM_DELAY
- PG_COMM_RECV_STREAM
- PG_COMM_SEND_STREAM
- PG_COMM_STATUS
- PG_CONTROL_GROUP_CONFIG
- PG_CURSORS
- PG_EXT_STATS
- PG_GET_INVALID_BACKENDS
- PG_GET_SENDERS_CATCHUP_TIME
- PG_GROUP
- PG_GTT_ATTACHED_PIDS
- PG_GTT_RELSTATS
- PG_GTT_STATS
- PG_INDEXES
- PG_LOCKS
- PG_NODE_ENV
- PG_OS_THREADS
- PG_PREPARED_STATEMENTS
- PG_PREPARED_XACTS
- PG_PUBLICATION_TABLES
- PG_REPLICATION_ORIGIN_STATUS
- PG_REPLICATION_SLOTS
- PG_RLSPOLICIES
- PG_ROLES
- PG_RULES
- PG_RUNNING_XACTS
- PG_SECLABELS
- PG_SESSION_IOSTAT
- PG_SESSION_WLMSTAT
- PG_SETTINGS
- PG_SHADOW
- PG_STAT_ACTIVITY
- PG_STAT_ACTIVITY_NG
- PG_STAT_ALL_INDEXES
- PG_STAT_ALL_TABLES
- PG_STAT_BAD_BLOCK
- PG_STAT_BGWRITER
- PG_STAT_DATABASE
- PG_STAT_DATABASE_CONFLICTS
- PG_STAT_REPLICATION
- PG_STAT_SUBSCRIPTION
- PG_STAT_SYS_INDEXES
- PG_STAT_SYS_TABLES
- PG_STAT_USER_FUNCTIONS
- PG_STAT_USER_INDEXES
- PG_STAT_USER_TABLES
- PG_STAT_XACT_ALL_TABLES
- PG_STAT_XACT_SYS_TABLES
- PG_STAT_XACT_USER_FUNCTIONS
- PG_STAT_XACT_USER_TABLES
- PG_STATIO_ALL_INDEXES
- PG_STATIO_ALL_SEQUENCES
- PG_STATIO_ALL_TABLES
- PG_STATIO_SYS_INDEXES
- PG_STATIO_SYS_SEQUENCES
- PG_STATIO_SYS_TABLES
- PG_STATIO_USER_INDEXES
- PG_STATIO_USER_SEQUENCES
- PG_STATIO_USER_TABLES
- PG_STATS
- PG_TABLES
- PG_TDE_INFO
- PG_THREAD_WAIT_STATUS
- PG_TIMEZONE_ABBREVS
- PG_TIMEZONE_NAMES
- PG_TOTAL_MEMORY_DETAIL
- PG_TOTAL_USER_RESOURCE_INFO
- PG_TOTAL_USER_RESOURCE_INFO_OID
- PG_USER
- PG_USER_MAPPINGS
- PG_VARIABLE_INFO
- PG_VIEWS
- PG_WLM_STATISTICS
- PGXC_PREPARED_XACTS
- PLAN_TABLE
- Functions and Operators
- Logical Operators
- Comparison Operators
- Character Processing Functions and Operators
- Binary String Functions and Operators
- Bit String Functions and Operators
- Mode Matching Operators
- Mathematical Functions and Operators
- Date and Time Processing Functions and Operators
- Type Conversion Functions
- Geometric Functions and Operators
- Network Address Functions and Operators
- Text Search Functions and Operators
- JSON/JSONB Functions and Operators
- HLL Functions and Operators
- SEQUENCE Functions
- Array Functions and Operators
- Range Functions and Operators
- Aggregate Functions
- Window Functions(Analysis Functions)
- Security Functions
- Ledger Database Functions
- Encrypted Equality Functions
- Set Returning Functions
- Conditional Expression Functions
- System Information Functions
- System Administration Functions
- Configuration Settings Functions
- Universal File Access Functions
- Server Signal Functions
- Backup and Restoration Control Functions
- Snapshot Synchronization Functions
- Database Object Functions
- Advisory Lock Functions
- Logical Replication Functions
- Segment-Page Storage Functions
- Other Functions
- Undo System Functions
- Row-Store Compression System Functions
- Statistics Information Functions
- Trigger Functions
- Hash Function
- Prompt Message Function
- Global Temporary Table Functions
- Fault Injection System Function
- AI Feature Functions
- Dynamic Data Masking Functions
- Other System Functions
- Internal Functions
- Global SysCache Feature Functions
- Data Damage Detection and Repair Functions
- Obsolete Functions
- Supported Data Types
- Numeric Types
- Monetary Types
- Boolean Types
- Enumerated Types
- Character Types
- Binary Types
- Date/Time Types
- Geometric
- Network Address Types
- Bit String Types
- Text Search Types
- UUID
- JSON/JSONB Types
- HLL
- Array Types
- Range
- OID Types
- Pseudo-Types
- Data Types Supported by Column-store Tables
- XML Types
- Data Type Used by the Ledger Database
- SET Type
- SQL Syntax
- ABORT
- ALTER AGGREGATE
- ALTER AUDIT POLICY
- ALTER DATABASE
- ALTER DATA SOURCE
- ALTER DEFAULT PRIVILEGES
- ALTER DIRECTORY
- ALTER EXTENSION
- ALTER FOREIGN TABLE
- ALTER FUNCTION
- ALTER GLOBAL CONFIGURATION
- ALTER GROUP
- ALTER INDEX
- ALTER LANGUAGE
- ALTER LARGE OBJECT
- ALTER MASKING POLICY
- ALTER MATERIALIZED VIEW
- ALTER PACKAGE
- ALTER PROCEDURE
- ALTER PUBLICATION
- ALTER RESOURCE LABEL
- ALTER RESOURCE POOL
- ALTER ROLE
- ALTER ROW LEVEL SECURITY POLICY
- ALTER RULE
- ALTER SCHEMA
- ALTER SEQUENCE
- ALTER SERVER
- ALTER SESSION
- ALTER SUBSCRIPTION
- ALTER SYNONYM
- ALTER SYSTEM KILL SESSION
- ALTER SYSTEM SET
- ALTER TABLE
- ALTER TABLE PARTITION
- ALTER TABLE SUBPARTITION
- ALTER TABLESPACE
- ALTER TEXT SEARCH CONFIGURATION
- ALTER TEXT SEARCH DICTIONARY
- ALTER TRIGGER
- ALTER TYPE
- ALTER USER
- ALTER USER MAPPING
- ALTER VIEW
- ANALYZE | ANALYSE
- BEGIN
- CALL
- CHECKPOINT
- CLEAN CONNECTION
- CLOSE
- CLUSTER
- COMMENT
- COMMIT | END
- COMMIT PREPARED
- CONNECT BY
- COPY
- CREATE AGGREGATE
- CREATE AUDIT POLICY
- CREATE CAST
- CREATE CLIENT MASTER KEY
- CREATE COLUMN ENCRYPTION KEY
- CREATE DATABASE
- CREATE DATA SOURCE
- CREATE DIRECTORY
- CREATE EXTENSION
- CREATE FOREIGN TABLE
- CREATE FUNCTION
- CREATE GROUP
- CREATE INCREMENTAL MATERIALIZED VIEW
- CREATE INDEX
- CREATE LANGUAGE
- CREATE MASKING POLICY
- CREATE MATERIALIZED VIEW
- CREATE MODEL
- CREATE OPERATOR
- CREATE PACKAGE
- CREATE PROCEDURE
- CREATE PUBLICATION
- CREATE RESOURCE LABEL
- CREATE RESOURCE POOL
- CREATE ROLE
- CREATE ROW LEVEL SECURITY POLICY
- CREATE RULE
- CREATE SCHEMA
- CREATE SEQUENCE
- CREATE SERVER
- CREATE SUBSCRIPTION
- CREATE SYNONYM
- CREATE TABLE
- CREATE TABLE AS
- CREATE TABLE PARTITION
- CREATE TABLE SUBPARTITION
- CREATE TABLESPACE
- CREATE TEXT SEARCH CONFIGURATION
- CREATE TEXT SEARCH DICTIONARY
- CREATE TRIGGER
- CREATE TYPE
- CREATE USER
- CREATE USER MAPPING
- CREATE VIEW
- CREATE WEAK PASSWORD DICTIONARY
- CURSOR
- DEALLOCATE
- DECLARE
- DELETE
- DO
- DROP AGGREGATE
- DROP AUDIT POLICY
- DROP CAST
- DROP CLIENT MASTER KEY
- DROP COLUMN ENCRYPTION KEY
- DROP DATABASE
- DROP DATA SOURCE
- DROP DIRECTORY
- DROP EXTENSION
- DROP FOREIGN TABLE
- DROP FUNCTION
- DROP GLOBAL CONFIGURATION
- DROP GROUP
- DROP INDEX
- DROP LANGUAGE
- DROP MASKING POLICY
- DROP MATERIALIZED VIEW
- DROP MODEL
- DROP OPERATOR
- DROP OWNED
- DROP PACKAGE
- DROP PROCEDURE
- DROP PUBLICATION
- DROP RESOURCE LABEL
- DROP RESOURCE POOL
- DROP ROLE
- DROP ROW LEVEL SECURITY POLICY
- DROP RULE
- DROP SCHEMA
- DROP SEQUENCE
- DROP SERVER
- DROP SUBSCRIPTION
- DROP SYNONYM
- DROP TABLE
- DROP TABLESPACE
- DROP TEXT SEARCH CONFIGURATION
- DROP TEXT SEARCH DICTIONARY
- DROP TRIGGER
- DROP TYPE
- DROP USER
- DROP USER MAPPING
- DROP VIEW
- DROP WEAK PASSWORD DICTIONARY
- EXECUTE
- EXECUTE DIRECT
- EXPLAIN
- EXPLAIN PLAN
- FETCH
- GRANT
- INSERT
- LOCK
- MERGE INTO
- MOVE
- PREDICT BY
- PREPARE
- PREPARE TRANSACTION
- PURGE
- REASSIGN OWNED
- REFRESH INCREMENTAL MATERIALIZED VIEW
- REFRESH MATERIALIZED VIEW
- REINDEX
- RELEASE SAVEPOINT
- RESET
- REVOKE
- ROLLBACK
- ROLLBACK PREPARED
- ROLLBACK TO SAVEPOINT
- SAVEPOINT
- SELECT
- SELECT INTO
- SET
- SET CONSTRAINTS
- SET ROLE
- SET SESSION AUTHORIZATION
- SET TRANSACTION
- SHOW
- SHUTDOWN
- SNAPSHOT
- START TRANSACTION
- TIMECAPSULE TABLE
- TRUNCATE
- UPDATE
- VACUUM
- VALUES
- SHRINK
- SQL Reference
- MogDB SQL
- Keywords
- Constant and Macro
- Expressions
- Type Conversion
- Full Text Search
- Introduction
- Tables and Indexes
- Controlling Text Search
- Additional Features
- Parser
- Dictionaries
- Configuration Examples
- Testing and Debugging Text Search
- Limitations
- System Operation
- Controlling Transactions
- DDL Syntax Overview
- DML Syntax Overview
- DCL Syntax Overview
- Appendix
- GUC Parameters
- GUC Parameter Usage
- GUC Parameter List
- File Location
- Connection and Authentication
- Resource Consumption
- Write Ahead Log
- HA Replication
- Memory Table
- Query Planning
- Error Reporting and Logging
- Alarm Detection
- Statistics During the Database Running
- Load Management
- Automatic Vacuuming
- Default Settings of Client Connection
- Lock Management
- Version and Platform Compatibility
- Faut Tolerance
- Connection Pool Parameters
- MogDB Transaction
- Replication Parameters of Two Database Instances
- Developer Options
- Auditing
- CM Parameters
- Upgrade Parameters
- Miscellaneous Parameters
- Wait Events
- Query
- System Performance Snapshot
- Security Configuration
- Global Temporary Table
- HyperLogLog
- Scheduled Task
- Thread Pool
- User-defined Functions
- Backup and Restoration
- Undo
- DCF Parameters Settings
- Flashback
- Rollback Parameters
- Reserved Parameters
- AI Features
- Global SysCache Parameters
- Parameters Related to Efficient Data Compression Algorithms
- Appendix
- Schema
- Overview
- Information Schema
- DBE_PERF
- Overview
- OS
- Instance
- Memory
- File
- Object
- STAT_USER_TABLES
- SUMMARY_STAT_USER_TABLES
- GLOBAL_STAT_USER_TABLES
- STAT_USER_INDEXES
- SUMMARY_STAT_USER_INDEXES
- GLOBAL_STAT_USER_INDEXES
- STAT_SYS_TABLES
- SUMMARY_STAT_SYS_TABLES
- GLOBAL_STAT_SYS_TABLES
- STAT_SYS_INDEXES
- SUMMARY_STAT_SYS_INDEXES
- GLOBAL_STAT_SYS_INDEXES
- STAT_ALL_TABLES
- SUMMARY_STAT_ALL_TABLES
- GLOBAL_STAT_ALL_TABLES
- STAT_ALL_INDEXES
- SUMMARY_STAT_ALL_INDEXES
- GLOBAL_STAT_ALL_INDEXES
- STAT_DATABASE
- SUMMARY_STAT_DATABASE
- GLOBAL_STAT_DATABASE
- STAT_DATABASE_CONFLICTS
- SUMMARY_STAT_DATABASE_CONFLICTS
- GLOBAL_STAT_DATABASE_CONFLICTS
- STAT_XACT_ALL_TABLES
- SUMMARY_STAT_XACT_ALL_TABLES
- GLOBAL_STAT_XACT_ALL_TABLES
- STAT_XACT_SYS_TABLES
- SUMMARY_STAT_XACT_SYS_TABLES
- GLOBAL_STAT_XACT_SYS_TABLES
- STAT_XACT_USER_TABLES
- SUMMARY_STAT_XACT_USER_TABLES
- GLOBAL_STAT_XACT_USER_TABLES
- STAT_XACT_USER_FUNCTIONS
- SUMMARY_STAT_XACT_USER_FUNCTIONS
- GLOBAL_STAT_XACT_USER_FUNCTIONS
- STAT_BAD_BLOCK
- SUMMARY_STAT_BAD_BLOCK
- GLOBAL_STAT_BAD_BLOCK
- STAT_USER_FUNCTIONS
- SUMMARY_STAT_USER_FUNCTIONS
- GLOBAL_STAT_USER_FUNCTIONS
- Workload
- Session/Thread
- SESSION_STAT
- GLOBAL_SESSION_STAT
- SESSION_TIME
- GLOBAL_SESSION_TIME
- SESSION_MEMORY
- GLOBAL_SESSION_MEMORY
- SESSION_MEMORY_DETAIL
- GLOBAL_SESSION_MEMORY_DETAIL
- SESSION_STAT_ACTIVITY
- GLOBAL_SESSION_STAT_ACTIVITY
- THREAD_WAIT_STATUS
- GLOBAL_THREAD_WAIT_STATUS
- LOCAL_THREADPOOL_STATUS
- GLOBAL_THREADPOOL_STATUS
- SESSION_CPU_RUNTIME
- SESSION_MEMORY_RUNTIME
- STATEMENT_IOSTAT_COMPLEX_RUNTIME
- LOCAL_ACTIVE_SESSION
- Transaction
- Query
- STATEMENT
- SUMMARY_STATEMENT
- STATEMENT_COUNT
- GLOBAL_STATEMENT_COUNT
- SUMMARY_STATEMENT_COUNT
- GLOBAL_STATEMENT_COMPLEX_HISTORY
- GLOBAL_STATEMENT_COMPLEX_HISTORY_TABLE
- GLOBAL_STATEMENT_COMPLEX_RUNTIME
- STATEMENT_RESPONSETIME_PERCENTILE
- STATEMENT_COMPLEX_RUNTIME
- STATEMENT_COMPLEX_HISTORY_TABLE
- STATEMENT_COMPLEX_HISTORY
- STATEMENT_WLMSTAT_COMPLEX_RUNTIME
- STATEMENT_HISTORY
- Cache/IO
- STATIO_USER_TABLES
- SUMMARY_STATIO_USER_TABLES
- GLOBAL_STATIO_USER_TABLES
- STATIO_USER_INDEXES
- SUMMARY_STATIO_USER_INDEXES
- GLOBAL_STATIO_USER_INDEXES
- STATIO_USER_SEQUENCES
- SUMMARY_STATIO_USER_SEQUENCES
- GLOBAL_STATIO_USER_SEQUENCES
- STATIO_SYS_TABLES
- SUMMARY_STATIO_SYS_TABLES
- GLOBAL_STATIO_SYS_TABLES
- STATIO_SYS_INDEXES
- SUMMARY_STATIO_SYS_INDEXES
- GLOBAL_STATIO_SYS_INDEXES
- STATIO_SYS_SEQUENCES
- SUMMARY_STATIO_SYS_SEQUENCES
- GLOBAL_STATIO_SYS_SEQUENCES
- STATIO_ALL_TABLES
- SUMMARY_STATIO_ALL_TABLES
- GLOBAL_STATIO_ALL_TABLES
- STATIO_ALL_INDEXES
- SUMMARY_STATIO_ALL_INDEXES
- GLOBAL_STATIO_ALL_INDEXES
- STATIO_ALL_SEQUENCES
- SUMMARY_STATIO_ALL_SEQUENCES
- GLOBAL_STATIO_ALL_SEQUENCES
- GLOBAL_STAT_DB_CU
- GLOBAL_STAT_SESSION_CU
- Utility
- REPLICATION_STAT
- GLOBAL_REPLICATION_STAT
- REPLICATION_SLOTS
- GLOBAL_REPLICATION_SLOTS
- BGWRITER_STAT
- GLOBAL_BGWRITER_STAT
- GLOBAL_CKPT_STATUS
- GLOBAL_DOUBLE_WRITE_STATUS
- GLOBAL_PAGEWRITER_STATUS
- GLOBAL_RECORD_RESET_TIME
- GLOBAL_REDO_STATUS
- GLOBAL_RECOVERY_STATUS
- CLASS_VITAL_INFO
- USER_LOGIN
- SUMMARY_USER_LOGIN
- GLOBAL_GET_BGWRITER_STATUS
- GLOBAL_SINGLE_FLUSH_DW_STATUS
- GLOBAL_CANDIDATE_STATUS
- Lock
- Wait Events
- Configuration
- Operator
- Workload Manager
- Global Plancache
- RTO
- DBE_PLDEBUGGER Schema
- Overview
- DBE_PLDEBUGGER.turn_on
- DBE_PLDEBUGGER.turn_off
- DBE_PLDEBUGGER.local_debug_server_info
- DBE_PLDEBUGGER.attach
- DBE_PLDEBUGGER.info_locals
- DBE_PLDEBUGGER.next
- DBE_PLDEBUGGER.continue
- DBE_PLDEBUGGER.abort
- DBE_PLDEBUGGER.print_var
- DBE_PLDEBUGGER.info_code
- DBE_PLDEBUGGER.step
- DBE_PLDEBUGGER.add_breakpoint
- DBE_PLDEBUGGER.delete_breakpoint
- DBE_PLDEBUGGER.info_breakpoints
- DBE_PLDEBUGGER.backtrace
- DBE_PLDEBUGGER.disable_breakpoint
- DBE_PLDEBUGGER.enable_breakpoint
- DBE_PLDEBUGGER.finish
- DBE_PLDEBUGGER.set_var
- DB4AI Schema
- DBE_PLDEVELOPER
- Tool Reference
- Tool Overview
- Client Tool
- Server Tools
- Tools Used in the Internal System
- Unified Database Management Tool
- FAQ
- Functions of MogDB Executable Scripts
- System Catalogs and Views Supported by gs_collector
- Error Code Reference
- Description of SQL Error Codes
- Third-Party Library Error Codes
- GAUSS-00001 - GAUSS-00100
- GAUSS-00101 - GAUSS-00200
- GAUSS 00201 - GAUSS 00300
- GAUSS 00301 - GAUSS 00400
- GAUSS 00401 - GAUSS 00500
- GAUSS 00501 - GAUSS 00600
- GAUSS 00601 - GAUSS 00700
- GAUSS 00701 - GAUSS 00800
- GAUSS 00801 - GAUSS 00900
- GAUSS 00901 - GAUSS 01000
- GAUSS 01001 - GAUSS 01100
- GAUSS 01101 - GAUSS 01200
- GAUSS 01201 - GAUSS 01300
- GAUSS 01301 - GAUSS 01400
- GAUSS 01401 - GAUSS 01500
- GAUSS 01501 - GAUSS 01600
- GAUSS 01601 - GAUSS 01700
- GAUSS 01701 - GAUSS 01800
- GAUSS 01801 - GAUSS 01900
- GAUSS 01901 - GAUSS 02000
- GAUSS 02001 - GAUSS 02100
- GAUSS 02101 - GAUSS 02200
- GAUSS 02201 - GAUSS 02300
- GAUSS 02301 - GAUSS 02400
- GAUSS 02401 - GAUSS 02500
- GAUSS 02501 - GAUSS 02600
- GAUSS 02601 - GAUSS 02700
- GAUSS 02701 - GAUSS 02800
- GAUSS 02801 - GAUSS 02900
- GAUSS 02901 - GAUSS 03000
- GAUSS 03001 - GAUSS 03100
- GAUSS 03101 - GAUSS 03200
- GAUSS 03201 - GAUSS 03300
- GAUSS 03301 - GAUSS 03400
- GAUSS 03401 - GAUSS 03500
- GAUSS 03501 - GAUSS 03600
- GAUSS 03601 - GAUSS 03700
- GAUSS 03701 - GAUSS 03800
- GAUSS 03801 - GAUSS 03900
- GAUSS 03901 - GAUSS 04000
- GAUSS 04001 - GAUSS 04100
- GAUSS 04101 - GAUSS 04200
- GAUSS 04201 - GAUSS 04300
- GAUSS 04301 - GAUSS 04400
- GAUSS 04401 - GAUSS 04500
- GAUSS 04501 - GAUSS 04600
- GAUSS 04601 - GAUSS 04700
- GAUSS 04701 - GAUSS 04800
- GAUSS 04801 - GAUSS 04900
- GAUSS 04901 - GAUSS 05000
- GAUSS 05001 - GAUSS 05100
- GAUSS 05101 - GAUSS 05200
- GAUSS 05201 - GAUSS 05300
- GAUSS 05301 - GAUSS 05400
- GAUSS 05401 - GAUSS 05500
- GAUSS 05501 - GAUSS 05600
- GAUSS 05601 - GAUSS 05700
- GAUSS 05701 - GAUSS 05800
- GAUSS 05801 - GAUSS 05900
- GAUSS 05901 - GAUSS 06000
- GAUSS 06001 - GAUSS 06100
- GAUSS 06101 - GAUSS 06200
- GAUSS 06201 - GAUSS 06300
- GAUSS 06301 - GAUSS 06400
- GAUSS 06401 - GAUSS 06500
- GAUSS 06501 - GAUSS 06600
- GAUSS 06601 - GAUSS 06700
- GAUSS 06701 - GAUSS 06800
- GAUSS 06801 - GAUSS 06900
- GAUSS 06901 - GAUSS 07000
- GAUSS 07001 - GAUSS 07100
- GAUSS 07101 - GAUSS 07200
- GAUSS 07201 - GAUSS 07300
- GAUSS 07301 - GAUSS 07400
- GAUSS 07401 - GAUSS 07480
- GAUSS 50000 - GAUSS 50999
- GAUSS 51000 - GAUSS 51999
- GAUSS 52000 - GAUSS 52999
- GAUSS 53000 - GAUSS 53799
- Error Log Reference
- System Catalogs and System Views
- Common Faults and Identification
- Common Fault Locating Methods
- Common Fault Locating Cases
- Core Fault Locating
- Permission/Session/Data Type Fault Location
- Service/High Availability/Concurrency Fault Location
- Standby Node in the Need Repair (WAL) State
- Service Startup Failure
- Primary Node Is Hung in Demoting During a Switchover
- "too many clients already" Is Reported or Threads Failed To Be Created in High Concurrency Scenarios
- Performance Deterioration Caused by Dirty Page Flushing Efficiency During TPCC High Concurrentcy Long Term Stable Running
- Table/Partition Table Fault Location
- File System/Disk/Memory Fault Location
- After You Run the du Command to Query Data File Size In the XFS File System, the Query Result Is Greater than the Actual File Size
- File Is Damaged in the XFS File System
- Insufficient Memory
- "Error:No space left on device" Is Displayed
- When the TPC-C is running and a disk to be injected is full, the TPC-C stops responding
- Disk Space Usage Reaches the Threshold and the Database Becomes Read-only
- SQL Fault Location
- Index Fault Location
- CM Two-Node Fault Location
- Source Code Parsing
- FAQs
- Glossary
- Communication Matrix
- Mogeaver
Character Processing Functions and Operators
String functions and operators provided by MogDB are for concatenating strings with each other, concatenating strings with non-strings, and matching the patterns of strings.
Note: Except length-related functions, other functions and operators of string processing functions do not support parameters greater than 1 GB.
-
bit_length(string)
Description: Specifies the number of bits occupied by a string.
Return type: int
Example:
MogDB=# SELECT bit_length('world'); bit_length ------------ 40 (1 row)
-
btrim(string text [, characters text])
Description: Removes the longest string consisting only of characters in characters (a space by default) from the start and end of string.
Return type: text
Example:
MogDB=# SELECT btrim('sring' , 'ing'); btrim ------- sr (1 row)
-
char_length(string) or character_length(string)
Description: Specifies the number of characters in a string.
Return type: int
Example:
MogDB=# SELECT char_length('hello'); char_length ------------- 5 (1 row)
-
instr(text,text,int,int)
Description: instr(string1,string2,int1,int2) returns the text from int1 to int2 in string1. The first int indicates the start position for matching, and the second int indicates the number of matching times.
Return type: int
Example:
MogDB=# SELECT instr( 'abcdabcdabcd', 'bcd', 2, 2 ); instr ------- 6 (1 row)
-
instrb(searchstr text, substring text, int64 position, int64 occurrence)
Description: Returns the position of the first byte of the specified occurrence of a substring in a string.
Return type: int64
Example:
MogDB=# select INSTRB('123456123', '123', 4); instrb -------- 7 (1 row)
-
insert(str,pos,len,newstr)
Description: Returns a string (str), in which len characters are replaced by a string (newstr) from pos.
Return type: string
Example:
MogDB=# SELECT INSERT('begtut.com', 1, 6, 'Example'); -------- Example.com (1 row)
NOTE: If pos is not within the length of the string, the original string is returned. If len is not within the length range of the rest of the string, replace the rest of the string from pos. If the parameter is null, NULL is returned.
-
lengthb(text/bpchar)
Description: Obtains the number of bytes of a specified string.
Return type: int
Example:
MogDB=# SELECT lengthb('hello'); lengthb --------- 5 (1 row)
-
left(str text, n int)
Description: Returns the first n characters in a string. When n is negative, all but the last |n| characters are returned.
Return type: text
Example:
MogDB=# SELECT left('abcde', 2); left ------ ab (1 row)
-
length(string bytea, encoding name )
Description: Specifies the number of characters in string in the given encoding. string must be valid in this encoding.
Return type: int
Example:
MogDB=# SELECT length('jose', 'UTF8'); length -------- 4 (1 row)
NOTE:
If the length of the bytea type is queried and UTF8 encoding is specified, the maximum length can only be 536870888.
-
lpad(string text, length int [, fill text])
Description: Fills up string to length by appending the characters fill (a space by default). If string is already longer than length, then it is truncated.
Return type: text
Example:
MogDB=# SELECT lpad('hi', 5, 'xyza'); lpad ------- xyzhi (1 row)
-
nls_charset_id(p1 name, p2 name default 'SQL_ASCII', P3 name default "SQL_ASCII")
Description: Returns the ID corresponding to the specified character set p1.
Return type: integer
Example:
MogDB=# SELECT NLS_CHARSET_ID('gbk'); nls_charset_id ---------------- 6 (1 row)
-
nls_charset_name(p1 integer, p2 integer default 0)
Description: Returns the name of the character set corresponding to the ID.
Return type: name
Example:
MogDB=# SELECT NLS_CHARSET_NAME(6); nls_charset_name ------------------ GBK (1 row)
-
nls_lower
Description: Returns all letters in lowercase.
Return type: string
Example:
MogDB=# SET search_path to whale; MogDB=# SELECT NLS_LOWER('AbC') FROM dual; ------- abc (1 row)
-
nls_upper
Description: Returns all letters in uppercase.
Return type: string
Example:
MogDB=# SET search_path to whale; MogDB=# SELECT NLS_UPPER('AbC') FROM dual; ------- ABC (1 row)
-
notlike(x bytea name text, y bytea text)
Description: Compares x and y to check whether they are inconsistent.
Return type: Boolean
Example:
MogDB=# SELECT notlike(1,2); notlike -------------- t (1 row) MogDB=# SELECT notlike(1,1); notlike -------------- f (1 row)
-
octet_length(string)
Description: Specifies the number of bytes in a string.
Return type: int
Example:
MogDB=# SELECT octet_length('jose'); octet_length -------------- 4 (1 row)
-
overlay(string placing string FROM int [for int])
Description: Replaces substrings. FROM int indicates the start position of the replacement in the first string. for int indicates the number of characters replaced in the first string.
Return type: text
Example:
MogDB=# SELECT overlay('hello' placing 'world' from 2 for 3 ); overlay --------- hworldo (1 row)
-
position(substring in string)
Description: Specifies the position of a substring. Parameters are case-sensitive.
Return type: int. If the character string does not exist, 0 is returned.
Example:
MogDB=# SELECT position('ing' in 'string'); position ---------- 4 (1 row)
-
pg_client_encoding()
Description: Specifies the current client encoding name.
Return type: name
Example:
MogDB=# SELECT pg_client_encoding(); pg_client_encoding -------------------- UTF8 (1 row)
-
quote_ident(string text)
Description: Returns the given string suitably quoted to be used as an identifier in an SQL statement string (quotation marks are used as required). Quotation marks are added only if necessary (that is, if the string contains non-identifier characters or would be case-folded). Embedded quotation marks are properly doubled.
Return type: text
Example:
MogDB=# SELECT quote_ident('hello world'); quote_ident -------------- "hello world" (1 row)
-
quote_literal(string text)
Description: Returns the given string suitably quoted to be used as a string literal in an SQL statement string (quotation marks are used as required).
Return type: text
Example:
MogDB=# SELECT quote_literal('hello'); quote_literal --------------- 'hello' (1 row)
If a command similar to the following exists, the text will be escaped.
MogDB=# SELECT quote_literal(E'O\'hello'); quote_literal --------------- 'O''hello' (1 row)
If a command similar to the following exists, the backslash will be properly doubled.
MogDB=# SELECT quote_literal('O\hello'); quote_literal --------------- E'O\\hello' (1 row)
If the parameter is null, NULL is returned. If the parameter may be null, you are advised to use quote_nullable.
MogDB=# SELECT quote_literal(NULL); quote_literal --------------- (1 row)
-
quote_literal(value anyelement)
Description: Converts the given value to text and then quotes it as a literal.
Return type: text
Example:
MogDB=# SELECT quote_literal(42.5); quote_literal --------------- '42.5' (1 row)
If a command similar to the following exists, the given value will be escaped.
MogDB=# SELECT quote_literal(E'O\'42.5'); quote_literal --------------- '0''42.5' (1 row)
If a command similar to the following exists, the backslash will be properly doubled.
MogDB=# SELECT quote_literal('O\42.5'); quote_literal --------------- E'O\\42.5' (1 row)
-
quote_nullable(string text)
Description: Returns the given string suitably quoted to be used as a string literal in an SQL statement string (quotation marks are used as required).
Return type: text
Example:
MogDB=# SELECT quote_nullable('hello'); quote_nullable ---------------- 'hello' (1 row)
If a command similar to the following exists, the text will be escaped.
MogDB=# SELECT quote_nullable(E'O\'hello'); quote_nullable ---------------- 'O''hello' (1 row)
If a command similar to the following exists, the backslash will be properly doubled.
MogDB=# SELECT quote_nullable('O\hello'); quote_nullable ---------------- E'O\\hello' (1 row)
If the parameter is null, NULL is returned.
MogDB=# SELECT quote_nullable(NULL); quote_nullable ---------------- NULL (1 row)
-
quote_nullable(value anyelement)
Description: Converts the given value to text and then quotes it as a literal.
Return type: text
Example:
MogDB=# SELECT quote_nullable(42.5); quote_nullable ---------------- '42.5' (1 row)
If a command similar to the following exists, the given value will be escaped.
MogDB=# SELECT quote_nullable(E'O\'42.5'); quote_nullable ---------------- 'O''42.5' (1 row)
If a command similar to the following exists, the backslash will be properly doubled.
MogDB=# SELECT quote_nullable('O\42.5'); quote_nullable ---------------- E'O\\42.5' (1 row)
If the parameter is null, NULL is returned.
MogDB=# SELECT quote_nullable(NULL); quote_nullable ---------------- NULL (1 row)
-
substring_inner(string [from int] [for int])
Description: Extracts a substring. from int indicates the start position of the truncation. for int indicates the number of characters truncated.
Return type: text
Example:
MogDB=# select substring_inner('adcde', 2,3); substring_inner ----------------- dcd (1 row)
-
substring(string [from int] [for int])
Description: Extracts a substring. from int indicates the start position of the truncation. for int indicates the number of characters truncated.
Return type: text
Example:
MogDB=# SELECT substring('Thomas' from 2 for 3); substring ----------- hom (1 row)
-
substring(string from pattern)
Description: Extracts substrings matching the POSIX regular expression. It returns the text that matches the pattern. If no match record is found, a null value is returned.
Return type: text
Example:
MogDB=# SELECT substring('Thomas' from '...$'); substring ----------- mas (1 row) MogDB=# SELECT substring('foobar' from 'o(.)b'); result -------- o (1 row) MogDB=# SELECT substring('foobar' from '(o(.)b)'); result -------- oob (1 row)
NOTE: If the POSIX pattern contains any parentheses, the portion of the text that matched the first parenthesized sub-expression (the one whose left parenthesis comes first) is returned. You can put parentheses around the whole expression if you want to use parentheses within it without triggering this exception.
-
substring(string from pattern for escape)
Description: Extracts substrings matching the SQL regular expression. The declared schema must match the entire data string; otherwise, the function fails and returns a null value. To indicate the part of the pattern that should be returned on success, the pattern must contain two occurrences of the escape character followed by a double quotation mark ("). The text matching the portion of the pattern between these marks is returned.
Return type: text
Example:
MogDB=# SELECT substring('Thomas' from '%#"o_a#"_' for '#'); substring ----------- oma (1 row)
-
rawcat(raw,raw)
Description: Indicates the string concatenation function.
Return type: raw
Example:
MogDB=# SELECT rawcat('ab','cd'); rawcat -------- ABCD (1 row)
-
regexp_like(text,text,text)
Description: Indicates the mode matching function of a regular expression.
Return type: Boolean
Example:
MogDB=# SELECT regexp_like('str','[ac]'); regexp_like ------------- f (1 row)
-
regexp_substr(string text, pattern text [, position int [, occurrence int [, flags text]]])
Description: Extracts substrings from a regular expression. Its function is similar to substr. When a regular expression contains multiple parallel brackets, it also needs to be processed.
Parameter description:
- string: source character string used for matching.
- pattern: regular expression pattern string used for matching.
- position: start character of the source string used for matching. This parameter is optional. The default value is 1.
- occurrence: sequence number of the matched substring to be extracted. This parameter is optional. The default value is 1.
- flags: contains zero or multiple single-letter flags that change the matching behavior of the function. This parameter is optional. m indicates multi-line matching. If the SQL syntax is compatible with products A and B and the value of the GUC parameter behavior_compat_options contains aformat_regexp_match, the option n indicates that the period (.) can match the '\n' character. If n is not specified in flags, the period (.) cannot match the '\n' character by default. If the value does not contain aformat_regexp_match, the period (.) matches the '\n' character by default. The meaning of option n is the same as that of option m.
Return type: text
Example:
MogDB=# SELECT regexp_substr('str','[ac]'); regexp_substr --------------- (1 row) MogDB=# SELECT regexp_substr('foobarbaz', 'b(..)', 3, 2) AS RESULT; result -------- baz (1 row)
-
regexp_count(string text, pattern text [, position int [, flags text]])
Description: obtains the number of substrings used for matching.
Parameter description:
- string: source character string used for matching.
- pattern: regular expression pattern string used for matching.
- position: sequence number of the character to be matched from the source character string. This parameter is optional. The default value is 1.
- flags: contains zero or multiple single-letter flags that change the matching behavior of the function. This parameter is optional. m indicates multi-line matching. If the SQL syntax is compatible with products A and B and the value of the GUC parameter behavior_compat_options contains aformat_regexp_match, the option n indicates that the period (.) can match the '\n' character. If n is not specified in flags, the period (.) cannot match the '\n' character by default. If the value does not contain aformat_regexp_match, the period (.) matches the '\n' character by default. The meaning of option n is the same as that of option m.
Return type: int
Example:
MogDB=# SELECT regexp_count('foobarbaz','b(..)', 5) AS RESULT; result -------- 1 (1 row)
-
regexp_instr(string text, pattern text [, position int [, occurrence int [, return_opt int [, flags text]]]])
Description: obtains the position (starting from 1) of the substring that meets the matching condition. If no substring is matched, 0 is returned.
Parameter description:
- string: source character string used for matching.
- pattern: regular expression pattern string used for matching.
- position: start character of the source string used for matching. This parameter is optional. The default value is 1.
- occurrence: sequence number of the matched substring to be replaced. This parameter is optional. The default value is 1.
- return_opt: specifies whether to return the position of the first or last character of the matched substring. This parameter is optional. If the value is 0, the position of the first character (starting from 1) of the matched substring is returned. If the value is greater than 0, the position of the next character of the end character of the matched substring is returned. The default value is 0.
- flags: contains zero or multiple single-letter flags that change the matching behavior of the function. This parameter is optional. m indicates multi-line matching. If the SQL syntax is compatible with products A and B and the value of the GUC parameter behavior_compat_options contains aformat_regexp_match, the option n indicates that the period (.) can match the '\n' character. If n is not specified in flags, the period (.) cannot match the '\n' character by default. If the value does not contain aformat_regexp_match, the period (.) matches the '\n' character by default. The meaning of option n is the same as that of option m.
Return type: int
Example:
MogDB=# SELECT regexp_instr('foobarbaz','b(..)', 1, 1, 0) AS RESULT; result -------- 4 (1 row) MogDB=# SELECT regexp_instr('foobarbaz','b(..)', 1, 2, 0) AS RESULT; result -------- 7 (1 row)
-
regexp_matches(string text, pattern text [, flags text])
Description: Returns all captured substrings resulting from matching a POSIX regular expression against string. If the pattern does not match, the function returns no rows. If the pattern contains no parenthesized sub-expressions, then each row returned is a single-element text array containing the substring matching the whole pattern. If the pattern contains parenthesized sub-expressions, the function returns a text array whose _n_th element is the substring matching the _n_th parenthesized sub-expression of the pattern.
The optional flags argument contains zero or multiple single-letter flags that change function behavior. i indicates that the matching is not related to uppercase and lowercase. g indicates that each matched substring is replaced, instead of replacing only the first one.
NOTICE: If the last parameter is provided but the parameter value is an empty string ('') and the SQL compatibility mode of the database is set to A, the returned result is an empty set. This is because the A compatibility mode treats the empty string ('') as NULL. To resolve this problem, you can:
- Change the database SQL compatibility mode to C.
- Do not provide the last parameter or do not set the last parameter to an empty string.
Return type: SETOF text[]
Example:
MogDB=# SELECT regexp_matches('foobarbequebaz', '(bar)(beque)'); regexp_matches ---------------- {bar,beque} (1 row) MogDB=# SELECT regexp_matches('foobarbequebaz', 'barbeque'); regexp_matches ---------------- {barbeque} (1 row) MogDB=# SELECT regexp_matches('foobarbequebazilbarfbonk', '(b[^b]+)(b[^b]+)', 'g'); result -------------- {bar,beque} {bazil,barf} (2 rows)
-
regexp_split_to_array(string text, pattern text [, flags text ])
Description: Splits string using a POSIX regular expression as the delimiter. The regexp_split_to_array function behaves the same as regexp_split_to_table, except that regexp_split_to_array returns its result as an array of text.
Return type: text[]
Example:
MogDB=# SELECT regexp_split_to_array('hello world', E'\\s+'); regexp_split_to_array ----------------------- {hello,world} (1 row)
-
regexp_split_to_table(string text, pattern text [, flags text])
Description: Splits string using a POSIX regular expression as the delimiter. If there is no match to the pattern, the function returns the string. If there is at least one match, for each match it returns the text from the end of the last match (or the beginning of the string) to the beginning of the match. When there are no more matches, it returns the text from the end of the last match to the end of the string.
The flags parameter is a text string containing zero or more single-letter flags that change the function's behavior. i indicates case-insensitive matching.
Return type: SETOF text
Example:
MogDB=# SELECT regexp_split_to_table('hello world', E'\\s+'); regexp_split_to_table ----------------------- hello world (2 rows)
-
repeat(string text, number int )
Description: Repeats string the specified number of times.
Return type: text
Example:
MogDB=# SELECT repeat('Pg', 4); repeat ---------- PgPgPgPg (1 row)
NOTE: The maximum size of memory allocated at a time cannot exceed 1 GB due to the memory allocation mechanism of the database. Therefore, the maximum value of number cannot exceed (1 GB - x)/lengthb (string) - 1. x indicates the length of the header information, which is usually greater than 4 bytes. The value varies among different scenarios.
-
replace(string text, from text, to text)
Description: Replaces all occurrences in string of substring from with substring to.
Return type: text
Example:
MogDB=# SELECT replace('abcdefabcdef', 'cd', 'XXX'); replace ---------------- abXXXefabXXXef (1 row)
-
replace(string, substring)
Description: Deletes all substrings in a string.
String type: text
Substring type: text
Return type: text
Example:
MogDB=# SELECT replace('abcdefabcdef', 'cd'); replace ---------------- abefabef (1 row)
-
replace(string, null)
Description: Returns the original string.
String type: text
Return type: text
Example:
MogDB=# select replace('abcd', null); replace --------- abcd (1 row)
-
reverse(str)
Description: Returns the reversed string.
Return type: text
Example:
MogDB=# SELECT reverse('abcde'); reverse --------- edcba (1 row)
-
right(str text, n int)
Description: Returns the last n characters in a string. When n is negative, all but the first |n| characters are returned.
Return type: text
Example:
MogDB=# SELECT right('abcde', 2); right ------- de (1 row) MogDB=# SELECT right('abcde', -2); right ------- cde (1 row)
-
rpad(string text, length int [, fill text])
Description: Fills up string to length by appending the characters fill (a space by default). If string is already longer than length, then it is truncated.
Return type: text
Example:
MogDB=# SELECT rpad('hi', 5, 'xy'); rpad ------- hixyx (1 row)
-
rtrim(string text [, characters text])
Description: Removes the longest string containing only characters from characters (a space by default) from the end of string.
Return type: text
Example:
MogDB=# SELECT rtrim('trimxxxx', 'x'); rtrim ------- trim (1 row)
-
substrb(text,int,int)
Description: Extracts a substring. The first intindicates the start position of the subtraction. The second int indicates the number of characters extracted.
Return type: text
Example:
MogDB=# SELECT substrb('string',2,3); substrb --------- tri (1 row)
-
substrb(text,int)
Description: Extracts a substring. int indicates the start position of the extraction.
Return type: text
Example:
MogDB=# SELECT substrb('string',2); substrb --------- tring (1 row)
-
substr(bytea,from,count)
Description: Extracts a substring from bytea. from specifies the position where the extraction starts. count specifies the length of the extracted substring.
Return type: text
Example:
MogDB=# SELECT substr('string',2,3); substr -------- tri (1 row)
-
string || string
Description: Concatenates strings.
Return type: text
Example:
MogDB=# SELECT 'MPP'||'DB' AS RESULT; result -------- MPPDB (1 row)
-
string || non-string or non-string || string
Description: Concatenates strings and non-strings.
Return type: text
Example:
MogDB=# SELECT 'Value: '||42 AS RESULT; result ----------- Value: 42 (1 row)
-
split_part(string text, delimiter text, field int)
Description: Splits string on delimiter and returns the fieldth column (counting from text of the first appeared delimiter).
Return type: text
Example:
MogDB=# SELECT split_part('abc~@~def~@~ghi', '~@~', 2); split_part ------------ def (1 row)
-
strpos(string, substring)
Description: Specifies the position of a substring. It is the same as position(substring in string). However, the parameter sequences of them are reversed.
Return type: int
Example:
MogDB=# SELECT strpos('source', 'rc'); strpos -------- 4 (1 row)
-
to_hex(number int or bigint)
Description: Converts a number to a hexadecimal expression.
Return type: text
Example:
MogDB=# SELECT to_hex(2147483647); to_hex ---------- 7fffffff (1 row)
-
translate(string text, from text, to text)
Description: Any character in string that matches a character in the from set is replaced by the corresponding character in the to set. If from is longer than to, extra characters occurred in from are removed.
Return type: text
Example:
MogDB=# SELECT translate('12345', '143', 'ax'); translate ----------- a2x5 (1 row)
-
length(string)
Description: Obtains the number of characters in a string.
Return type: integer
Example:
MogDB=# SELECT length('abcd'); length -------- 4 (1 row)
-
lengthb(string)
Description: Obtains the number of characters in a string. The value depends on character sets (GBK and UTF8).
Return type: integer
Example:
MogDB=# SELECT lengthb('Chinese'); lengthb --------- 7 (1 row)
-
substr(string,from)
Description:
Extracts substrings from a string.
from indicates the start position of the extraction.
- If from starts at 0, the value 1 is used.
- If the value of from is positive, all characters from from to the end are extracted.
- If the value of from is negative, the last n characters in the string are extracted, in which n indicates the absolute value of from.
Return type: varchar
Example:
If the value of from is positive:
MogDB=# SELECT substr('ABCDEF',2); substr -------- BCDEF (1 row)
If the value of from is negative:
MogDB=# SELECT substr('ABCDEF',-2); substr -------- EF (1 row)
-
substr(string,from,count)
Description:
Extracts substrings from a string.
from indicates the start position of the extraction.
count indicates the length of the extracted substring.
- If from starts at 0, the value 1 is used.
- If the value of from is positive, extract count characters starting from from.
- If the value of from is negative, extract the last n count characters in the string, in which n indicates the absolute value of from.
- If the value of count is smaller than 1, null is returned.
Return type: varchar
Example:
If the value of from is positive:
MogDB=# SELECT substr('ABCDEF',2,2); substr -------- BC (1 row)
If the value of from is negative:
MogDB=# SELECT substr('ABCDEF',-3,2); substr -------- DE (1 row)
-
substrb(string,from)
Description: The functionality of this function is the same as that of SUBSTR(string,from). However, the calculation unit is byte.
Return type: bytea
Example:
MogDB=# SELECT substrb('ABCDEF',-2); substrb --------- EF (1 row)
-
substrb(string,from,count)
Description: The functionality of this function is the same as that of SUBSTR(string,from,count). However, the calculation unit is byte.
Return type: bytea
Example:
MogDB=# SELECT substrb('ABCDEF',2,2); substrb --------- BC (1 row)
-
trim([leading |trailing |both] [characters] from string)
Description: Removes the longest string containing only the characters (a space by default) from the start/end/both ends of the string.
Return type: varchar
Example:
MogDB=# SELECT trim(BOTH 'x' FROM 'xTomxx'); btrim ------- Tom (1 row)
MogDB=# SELECT trim(LEADING 'x' FROM 'xTomxx'); ltrim ------- Tomxx (1 row)
MogDB=# SELECT trim(TRAILING 'x' FROM 'xTomxx'); rtrim ------- xTom (1 row)
-
rtrim(string [, characters])
Description: Removes the longest string containing only characters from characters (a space by default) from the end of string.
Return type: varchar
Example:
MogDB=# SELECT rtrim('TRIMxxxx','x'); rtrim ------- TRIM (1 row)
-
ltrim(string [, characters])
Description: Removes the longest string containing only characters from characters (a space by default) from the start of string.
Return type: varchar
Example:
MogDB=# SELECT ltrim('xxxxTRIM','x'); ltrim ------- TRIM (1 row)
-
upper(string)
Description: Converts the string into the uppercase.
Return type: varchar
Example:
MogDB=# SELECT upper('tom'); upper ------- TOM (1 row)
-
lower(string)
Description: Converts the string into the lowercase.
Return type: varchar
Example:
MogDB=# SELECT lower('TOM'); lower ------- tom (1 row)
-
rpad(string varchar, length int [, fill varchar])
Description: Fills up string to length by appending the characters fill (a space by default). If string is already longer than length, then it is truncated.
length in MogDB indicates the character length. One Chinese character is counted as one character.
Return type: varchar
Example:
MogDB=# SELECT rpad('hi',5,'xyza'); rpad ------- hixyz (1 row)
MogDB=# SELECT rpad('hi',5,'abcdefg'); rpad ------- hiabc (1 row)
-
instr(string,substring[,position,occurrence])
Description: Queries and returns the value of the substring position that occurs the occurrence (1 by default) times from the position (1 by default) in the string.
- If the value of position is 0, 0 is returned.
- If the value of position is negative, the search is performed backwards from the last _n_th character in the string, in which n indicates the absolute value of position.
In this function, the calculation unit is character. One Chinese character is one character.
Return type: integer
Example:
MogDB=# SELECT instr('corporate floor','or', 3); instr ------- 5 (1 row)
MogDB=# SELECT instr('corporate floor','or',-3,2); instr ------- 2 (1 row)
-
initcap(string)
Description: Converts the first letter of each word in the string into the uppercase and the other letters into the lowercase.
Return type: text
Example:
MogDB=# SELECT initcap('hi THOMAS'); initcap ----------- Hi Thomas (1 row)
-
ascii(string)
Description: Indicates the ASCII code of the first character in the string.
Return type: integer
Example:
MogDB=# SELECT ascii('xyz'); ascii ------- 120 (1 row)
-
replace(string varchar, search_string varchar, replacement_string varchar)
Description: Replaces all search_string in the string with replacement_string.
Return type: varchar
Example:
MogDB=# SELECT replace('jack and jue','j','bl'); replace ---------------- black and blue (1 row)
-
lpad(string varchar, length int[, repeat_string varchar])
Description: Adds a series of repeat_string (a space by default) on the left of the string to generate a new string with the total length of n.
If the length of the string is longer than the specified length, the function truncates the string and returns the substrings with the specified length.
Return type: varchar
Example:
MogDB=# SELECT lpad('PAGE 1',15,'*.'); lpad ----------------- *.*.*.*.*PAGE 1 (1 row)
MogDB=# SELECT lpad('hello world',5,'abcd'); lpad ------- hello (1 row)
-
concat(str1,str2)
Description: Connects str1 and str2 and returns the string.
NOTICE:
If the SQL compatibility mode is set to MY and str1 or str2 is set to NULL, NULL will be returned.
Return type: varchar
Example:
MogDB=# SELECT concat('Hello', ' World!'); concat -------------- Hello World! (1 row) MogDB=# SELECT concat('Hello', NULL); concat -------- Hello (1 row)
-
chr(integer)
Description: Specifies the character of the ASCII code.
Return type: varchar
Example:
MogDB=# SELECT chr(65); chr ----- A (1 row)
-
regexp_substr(source_char, pattern)
Description: Extracts substrings from a regular expression. If the SQL syntax is compatible with products A and B and the value of the GUC parameter behavior_compat_options contains aformat_regexp_match, the period (.) cannot match the '\n' character. If aformat_regexp_match is not contained, the period (.) matches the '\n' character by default.
Return type: varchar
Example:
MogDB=# SELECT regexp_substr('500 Hello World, Redwood Shores, CA', ',[^,]+,') "REGEXPR_SUBSTR"; REGEXPR_SUBSTR ------------------- , Redwood Shores, (1 row)
-
regexp_replace(string, pattern, replacement [,flags ])
Description: Replaces substrings matching the POSIX regular expression. The source string is returned unchanged if there is no match to the pattern. If there is a match, the source string is returned with the replacement string substituted for the matching substring.
The replacement string can contain \n, where n is 1 through 9, to indicate that the source substring matching the _n_th parenthesized sub-expression of the pattern should be inserted, and it can contain \& to indicate that the substring matching the entire pattern should be inserted.
The optional flags argument contains zero or multiple single-letter flags that change function behavior. i indicates that the matching is not related to uppercase and lowercase. g indicates that each matched substring is replaced, instead of replacing only the first one. m indicates multi-line matching. If the SQL syntax is compatible with products A and B and the value of the GUC parameter behavior_compat_options contains aformat_regexp_match, the option n indicates that the period (.) can match the '\n' character. If n is not specified in flags, the period (.) cannot match the '\n' character by default. If the value does not contain aformat_regexp_match, the period (.) matches the '\n' character by default. The meaning of option n is the same as that of option m.
Return type: varchar
Example:
MogDB=# SELECT regexp_replace('Thomas', '.[mN]a.', 'M'); regexp_replace ---------------- ThM (1 row) MogDB=# SELECT regexp_replace('foobarbaz','b(..)', E'X\\1Y', 'g') AS RESULT; result ------------- fooXarYXazY (1 row)
-
repexp_replace(string text, pattern text [, replacement text [, position int [, occurrence int [, flags text]]]])
Description: Replaces substrings matching the POSIX regular expression. The source string is returned unchanged if there is no match to the pattern. If there is a match, the source string is returned with the replacement string substituted for the matching substring.
Parameter description:
- string: source character string used for matching.
- pattern: regular expression pattern string used for matching.
- replacement:character string used to replace the matched substring. This parameter is optional. If no parameter value is specified or the parameter value is null, the parameter value is replaced with an empty string.
- position: start character of the source string used for matching. This parameter is optional. The default value is 1.
- occurrence: sequence number of the matched substring to be replaced. This parameter is optional. The default value is 0, indicating that all matched substrings are replaced.
- flags: contains zero or multiple single-letter flags that change the matching behavior of the function. This parameter is optional. m indicates multi-line matching. If the SQL syntax is compatible with products A and B and the value of the GUC parameter behavior_compat_options contains aformat_regexp_match, the option n indicates that the period (.) can match the '\n' character. If n is not specified in flags, the period (.) cannot match the '\n' character by default. If the value does not contain aformat_regexp_match, the period (.) matches the '\n' character by default. The meaning of option n is the same as that of option m.
Return type: text
Example:
MogDB=# SELECT regexp_replace('foobarbaz','b(..)', E'X\\1Y', 2, 2, 'n') AS RESULT; result ------------ foobarXazY (1 row)
-
concat_ws(sep text, str"any" [, str"any" [, …] ])
Description: Uses the first parameter as the separator, which is associated with all following parameters. The NULL parameter is ignored.
NOTICE:
- If the first parameter value is NULL, the returned result is NULL.
- If the first parameter is provided but the parameter value is an empty string ('') and the SQL compatibility mode of the database is set to A, the returned result is NULL. This is because the A compatibility mode treats the empty string ('') as NULL. To resolve this problem, you can change the SQL compatibility mode of the database to B, C, or PG.
Return type: text
Example:
MogDB=# SELECT concat_ws(',', 'ABCDE', 2, NULL, 22); concat_ws ------------ ABCDE,2,22 (1 row)
-
nlssort(string text, sort_method text)
Description: Returns the encoding value of a string in the sorting mode specified by sort_method. The encoding value can be used for sorting and determines the sequence of the string in the sorting mode. Currently, sort_method can be set to nls_sort=schinese_pinyin_m or nls_sort=generic_m_ci. nls_sort=generic_m_ci supports only the case-insensitive order for English characters.
String type: text
sort_method type: text
Return type: text
Example:
MogDB=# SELECT nlssort('A', 'nls_sort=schinese_pinyin_m'); nlssort ---------------- 01EA0000020006 (1 row) MogDB=# SELECT nlssort('A', 'nls_sort=generic_m_ci'); nlssort ---------------- 01EA000002 (1 row)
-
convert(string bytea, src_encoding name, dest_encoding name)
Description: Converts the bytea string to dest_encoding. src_encoding specifies the source code encoding. The string must be valid in this encoding.
Return type: bytea
Example:
MogDB=# SELECT convert('text_in_utf8', 'UTF8', 'GBK'); convert ---------------------------- \x746578745f696e5f75746638 (1 row)
NOTE: If the rule for converting between source to target encoding (for example, GBK and LATIN1) does not exist, the string is returned without conversion. See the pg_conversion system catalog for details. Example:
MogDB=# show server_encoding; server_encoding ----------------- LATIN1 (1 row) MogDB=# SELECT convert_from('some text', 'GBK'); convert_from -------------- some text (1 row) db_latin1=# SELECT convert_to('some text', 'GBK'); convert_to ---------------------- \x736f6d652074657874 (1 row) db_latin1=# SELECT convert('some text', 'GBK', 'LATIN1'); convert ---------------------- \x736f6d652074657874 (1 row)
-
convert_from(string bytea, src_encoding name)
Description: Converts the long bytea using the coding mode of the database.
src_encoding specifies the source code encoding. The string must be valid in this encoding.
Return type: text
Example:
MogDB=# SELECT convert_from('text_in_utf8', 'UTF8'); convert_from -------------- text_in_utf8 (1 row)
-
convert_to(string text, dest_encoding name)
Description: Converts a string to dest_encoding.
Return type: bytea
Example:
MogDB=# SELECT convert_to('some text', 'UTF8'); convert_to ---------------------- \x736f6d652074657874 (1 row)
-
string [NOT] LIKE pattern [ESCAPE escape-character]
Description: Specifies the pattern matching function.
If the pattern does not include a percentage sign (%) or an underscore (), this mode represents itself only. In this case, the behavior of LIKE is the same as the equal operator. The underscore () in the pattern matches any single character while one percentage sign (%) matches no or multiple characters.
To match with underscores (_) or percent signs (%), corresponding characters in pattern must lead escape characters. The default escape character is a backward slash () and can be specified using the ESCAPE clause. To match with escape characters, enter two escape characters.
Return type: Boolean
Example:
MogDB=# SELECT 'AA_BBCC' LIKE '%A@_B%' ESCAPE '@' AS RESULT; result -------- t (1 row)
MogDB=# SELECT 'AA_BBCC' LIKE '%A@_B%' AS RESULT; result -------- f (1 row)
MogDB=# SELECT 'AA@_BBCC' LIKE '%A@_B%' AS RESULT; result -------- t (1 row)
-
REGEXP_LIKE(source_string, pattern [, match_parameter])
Description: Indicates the mode matching function of a regular expression.
source_string indicates the source string and pattern indicates the matching pattern of the regular expression. match_parameter indicates the matching items and the values are as follows:
- 'i': case-insensitive
- 'c': case-sensitive
- 'n': allowing the metacharacter "." in a regular expression to be matched with a linefeed.
- 'm': allows source_string to be regarded as multiple rows.
If match_parameter is ignored, case-sensitive is enabled by default, "." is not matched with a linefeed, and source_string is regarded as a single row.
Return type: Boolean
Example:
MogDB=# SELECT regexp_like('ABC', '[A-Z]'); regexp_like ------------- t (1 row)
MogDB=# SELECT regexp_like('ABC', '[D-Z]'); regexp_like ------------- f (1 row)
MogDB=# SELECT regexp_like('ABC', '[a-z]','i'); regexp_like ------------- t (1 row)
-
format(formatstr text [, str"any" [, …] ])
Description: Formats a string.
Return type: text
Example:
MogDB=# SELECT format('Hello %s, %1$s', 'World'); format -------------------- Hello World, World (1 row)
-
md5(string)
Description: Encrypts a string in MD5 mode and returns a value in hexadecimal form.
NOTE: The MD5 encryption algorithm is not recommended because it has lower security and poses security risks.
Return type: text
Example:
MogDB=# SELECT md5('ABC'); md5 ---------------------------------- 902fbdd2b1df0c4f70b4a5d23525e932 (1 row)
-
sha(string) / sha1(string)
Description: Encrypts a string using SHA1 and returns a hexadecimal number. The sha and sha1 functions are the same.
NOTE: The SHA1 encryption algorithm is not recommended because it has lower security and poses security risks. This function is valid only when MogDB is compatible with the MY type (that is, sql_compatibility = 'B').
Return type: text
Example:
MogDB=# select sha('ABC'); sha ------------------------------------------ 3c01bdbb26f358bab27f267924aa2c9a03fcfdb8 (1 row) MogDB=# select sha1('ABC'); sha1 ------------------------------------------ 3c01bdbb26f358bab27f267924aa2c9a03fcfdb8 (1 row)
-
sha2(string, hash_length)
Description: Encrypts a string in SHA2 mode and returns a value in hexadecimal form.
hash_length: corresponds to the SHA2 algorithm. The value can be 0(SHA-256), 224(SHA-224), 256(SHA-256), 384(SHA-384), or 512(SHA-512). For other values, NULL is returned.
NOTE: The SHA224 encryption algorithm is not recommended because it has lower security and poses security risks. The SHA2 function records hash plaintext in logs. Therefore, you are not advised to use this function to encrypt sensitive information such as keys. This function is valid only when MogDB is compatible with the MY type (that is, sql_compatibility = 'B').
Return type: text
Example:
MogDB=# select sha2('ABC',224); sha2 ---------------------------------------------------------- 107c5072b799c4771f328304cfe1ebb375eb6ea7f35a3aa753836fad (1 row) MogDB=# select sha2('ABC',256); sha2 ------------------------------------------------------------------ b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78 (1 row) MogDB=# select sha2('ABC',0); sha2 ------------------------------------------------------------------ b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78 (1 row)
-
decode(string text, format text)
Description: Decodes binary data from textual representation. Supported formats are:
base64
,hex
,escape
.Return type: bytea
Example:
MogDB=# SELECT decode('MTIzAAE=', 'base64'); decode -------------- \x3132330001 (1 row)
-
similar_escape(pat text, esc text)
Description: Converts a regular expression of the SQL:2008 style to the POSIX style.
Return type: text
Example:
MogDB=# select similar_escape('\s+ab','2'); similar_escape ---------------- ^(?:\\s+ab)$ (1 row)
-
svals(hstore)
Description: Obtains the value of the hstore type.
Return type: SETOF text
Example:
MogDB=# select svals('"aa"=>"bb"'); svals ------- bb (1 row)
-
tconvert(key text, value text)
Description: Converts character strings to the hstore format.
Return type: hstore
Example:
MogDB=# select tconvert('aa', 'bb'); tconvert ------------ "aa"=>"bb" (1 row)
-
find_in_set(text, set)
Description: Finds the position of a given member in a set, counting from 1. If no record is found, 0 is returned.
Return type: int2
Example:
MogDB=# select site, find_in_set('wuhan', site) from employee; site | find_in_set -----------------+------------- beijing,nanjing | 0 beijing,wuhan | 2 (2 rows)
-
encode(data bytea, format text)
Description: Encodes binary data into a textual representation. Supported formats are:
base64
,hex
,escape
.escape
converts zero bytes and high-bit-set bytes to octal sequences (\nnn
) and doubles backslashes.Return type: text
Example:
MogDB=# SELECT encode(E'123\\000\\001', 'base64'); encode ---------- MTIzAAE= (1 row)
NOTE:
- For a string containing newline characters, for example, a string consisting of a newline character and a space, the value of length and lengthb in MogDB is 2.
- In MogDB, n in the CHAR(n) type indicates the number of characters. Therefore, for multiple-octet coded character sets, the length returned by the LENGTHB function may be longer than n.
- MogDB supports multiple types of databases, including A, B, C, and PG. If the database type is not specified, A is used by default. The lexical analyzer of A database is different from that of the other three databases. In A database, an empty character string is considered as NULL. Therefore, when a type A database is used, if a NULL character string is used as a parameter in the preceding character operation function, no output is displayed. For example:
MogDB=# SELECT translate('12345','123',''); translate ----------- (1 row)
This is because the kernel checks whether the input parameter contains NULL before calling the corresponding function. If yes, the kernel does not call the corresponding function. As a result, no output is displayed. In PG mode, the processing of character strings is the same as that of PostgreSQL. Therefore, the preceding problem does not occur.