Preamble
The PostgreSQL replace function replaces all occurrences of the specified string.
Syntax of the replace function in PostgreSQL
replace( string, from_substring, to_substring )
Parameters and arguments
- string – Source line.
- from_substring – A search substring. All entries from_substring found in the string are replaced by to_substring.
- to_substring – Replacement of substring. All occurrences from_substring found in the string are replaced by to_substring.
Note:
- The replace function performs case sensitive replacement.
The replace function can be used in future versions of PostgreSQL
PostgreSQL 11, PostgreSQL 10, PostgreSQL 9.6, PostgreSQL 9.5, PostgreSQL 9.4, PostgreSQL 9.3, PostgreSQL 9.2, PostgreSQL 9.1, PostgreSQL 9.0, PostgreSQL 8.4.
Let’s look at some examples of replace functions to understand how to use the replace function in PostgreSQL.
For example:
SELECT replace('Google.com', 'Google', 'Bing');
--Result: Bing.com
SELECT replace('Google.com', 'google', 'bing');
--Result: Google.com
SELECT replace('abc abc', 'a', 'B');
--Result: Bbc Bbc
SELECT replace('abc abc', 'A', 'B');
--Result: abc abc
SQL String Functions Tutorial (LEFT, RIGHT, POSITION, CONCAT, LOWER, REPLACE)
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
AI Model–Powered Database Optimization for Real Estate: Performance Management and Cost Attribution with Enteros
- 4 February 2026
- Database Performance Management
Introduction The real estate sector is undergoing a profound digital transformation. Property management platforms, digital leasing systems, smart building technologies, tenant experience apps, AI-driven valuation models, ESG reporting tools, and real-time analytics now form the backbone of modern real estate enterprises. Behind every one of these systems lies a complex database ecosystem—supporting high transaction volumes, … Continue reading “AI Model–Powered Database Optimization for Real Estate: Performance Management and Cost Attribution with Enteros”
Accurate Cost Estimation for Telecom Databases: How Enteros Aligns AIOps and Performance Intelligence
Introduction Telecom organizations are operating at an unprecedented scale. 5G rollouts, digital service platforms, real-time billing systems, subscriber analytics, IoT connectivity, and AI-driven customer engagement have pushed data volumes and transaction complexity to new extremes. Yet while networks continue to modernize, database economics remain poorly understood. Most telecom leaders know their cloud bills are rising. … Continue reading “Accurate Cost Estimation for Telecom Databases: How Enteros Aligns AIOps and Performance Intelligence”
Modernizing Insurance Database Management: How Enteros Uses AI SQL for Cost Estimation and Performance Control
- 3 February 2026
- Database Performance Management
Introduction The insurance industry is in the midst of a fundamental technology transformation. Digital policy issuance, real-time claims processing, AI-powered underwriting, fraud detection, omnichannel customer engagement, and regulatory reporting are no longer optional—they are core to competitiveness and compliance. Behind every modern insurance capability lies a complex database ecosystem. Policy administration systems, claims platforms, actuarial … Continue reading “Modernizing Insurance Database Management: How Enteros Uses AI SQL for Cost Estimation and Performance Control”
Where Technology Performance Meets Revenue Efficiency: Enteros AIOps-Driven Database Optimization Platform
Introduction Technology companies today operate in an environment defined by scale, speed, and constant innovation. Whether delivering SaaS platforms, digital services, AI-driven applications, or data-intensive products, performance is no longer just an engineering concern—it is a direct driver of revenue efficiency. Yet, as technology platforms scale, a critical disconnect often emerges. Engineering teams focus on … Continue reading “Where Technology Performance Meets Revenue Efficiency: Enteros AIOps-Driven Database Optimization Platform”