Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iaSaD-0003RC-U9 for pgsql-general@arkaria.postgresql.org; Thu, 28 Nov 2019 22:48:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iaSaB-0004OU-7x for pgsql-general@arkaria.postgresql.org; Thu, 28 Nov 2019 22:48:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iaSaA-0004NK-RU for pgsql-general@lists.postgresql.org; Thu, 28 Nov 2019 22:48:18 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iaSa4-0005AQ-4j for pgsql-general@lists.postgresql.org; Thu, 28 Nov 2019 22:48:18 +0000 Received: by mail-oi1-x22e.google.com with SMTP id l20so24459577oie.10 for ; Thu, 28 Nov 2019 14:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Z0mOZwqBADW0kVlorjF5oVOcW130N9d8grGXi6oOGU4=; b=XNUYEQvCOGY6rdkAi7B8FgpnSXkcidN3b+fvD957oKdahD0TOoPq0JLoS0Rrgf1egA AXg+so6a2JOjwIjhxlpJPF3zTNQc0eAk+b+vCyi5SpQMYLUlGV8cY/Bpj5UVpMjHFoTM daaXYxOzSlIezkfoJ91XJmnpyts4SWB5baaogXc3cGcSGcXnmper1eQyqC3rBPJf94vS GcB+DjFpIsrfuSJFzVmGZxqTCXQdR2AQAEs1j85IacZ1X1hE9WCwwZgx89zTPKzu+98n 4fHH0u5GSJnQSs1l15dVDiGd+Ak5RGgvOBzobFJjuHbB7xzjG0Qm2G8NJ4kkcRpDS7Ik +Gjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Z0mOZwqBADW0kVlorjF5oVOcW130N9d8grGXi6oOGU4=; b=L3qdFjJmhktUYkVeuPcFWsXMrKollwcQfGpH+O1GFXZ8zlgLgTnACppIMZzVLFRfYw K8rfjVA7szo9cVEFjwS3fyVK+XDK0mZkyF9FdQi37vo5t3OO39MUWWdAvkBDCQAUzxwh mm+BMNv++SEl4WiaORsF8Uhb8DNMGm1ytSZkHdvopsMb2X+lvi8hSx/hs9YV4c8Sra3c mfLUjgxNbgpjfUGXZKTjCce4rJN6NYo7aN0D+ONukTmbNjM4Ejg4fnWPtITCbzW49owO OFrvEJSaqc7pWaZJpI1T+Br2dfx7ca9t105zCMiX8FFaqBTj+ih/+EVeX4DsEGH5/VWn VRdw== X-Gm-Message-State: APjAAAXht3/JMG9gVtUfdKjF4oSmfALpOZayZENLHlhqss9pLlMZOE/J h4orCosxgjDr7L6zDHCp3L4= X-Google-Smtp-Source: APXvYqwQBdX6dqu552mLOJ7Cq4HaH0mmG8jRd7pKjUmlIbk7+ZLoDv1fUE22+x/j6gBeAaBaxyDK9w== X-Received: by 2002:aca:ddc2:: with SMTP id u185mr10384742oig.174.1574981290245; Thu, 28 Nov 2019 14:48:10 -0800 (PST) Received: from kitselas.attlocal.net (108-65-77-8.lightspeed.sntcca.sbcglobal.net. [108.65.77.8]) by smtp.gmail.com with ESMTPSA id c15sm6573214otk.12.2019.11.28.14.48.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Nov 2019 14:48:09 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: using replace function From: Rob Sargent In-Reply-To: Date: Thu, 28 Nov 2019 14:48:07 -0800 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Antonio Silva X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Nov 28, 2019, at 1:09 PM, Antonio Silva = wrote: >=20 > Hello list >=20 > I want to replace a string (not a substring) in a field but making = sure that the string in the full field. >=20 > In the example below since 'blue' is not the full text in 'blue shark' = there should not have a replacement. >=20 > How to say "replace only with 'blue' if it is the full string in the = field". >=20 > With REPLACE I get: >=20 > SELECT REPLACE('blue shark','blue','blue fish'); > replace =20 > ----------------- > blue fish shark > (1 row) >=20 > but I would like to get: >=20 > SELECT REPLACE('blue shark','blue','blue fish'); > replace =20 > ------------ > blue shark > (1 row) >=20 > Thanks a lot >=20 > Antonio Olinto does this help? select replace (a.col, =E2=80=98value=E2=80=99, =E2=80=99new value=E2=80=99= ) where a.col =3D =E2=80=98value=E2=80=99;