Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nebGj-0002KE-Me for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Apr 2022 11:34:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nebGh-0001vg-Ka for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Apr 2022 11:34:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nebGh-0001uJ-AK for pgsql-bugs@lists.postgresql.org; Wed, 13 Apr 2022 11:34:39 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nebGf-0007y8-8f for pgsql-bugs@lists.postgresql.org; Wed, 13 Apr 2022 11:34:38 +0000 Received: by mail-pl1-x632.google.com with SMTP id c12so1712153plr.6 for ; Wed, 13 Apr 2022 04:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=KMUpBaUuwUEnV5pSQWjG9EzVts2K+y92SM/kCGWAnmU=; b=hPfnKphyv2y81CQySrCmCfdT0+SfnrpFKqI5B35EhFpZLKlSWf9FaT55rDZ9m90Gum UiRziQFmGUz2I01HEofnHE5lQWzlX3MfYQ7vmLygjazSSl8NmD0wy8Kt9LNlF2FglzRs kA58R3BuLwJ+A8W4ym/XwdfpmwmOffIbaKS5EfdhSFMmo9BktFG/uQ6MpAUT7odKimrc kARtzPBMmxkGpebZsIJPRao3zdRuCq9Xn2sfywMlTTc4qgxhVz9f/d4FlcoPkcrN7NQe zvdCQy3Ik+kPULndxvaW8F/ca3xhMl16vGxsYzKQ2u3wNEN6aSZg/zcV0X/5crvsnmPM 2lwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=KMUpBaUuwUEnV5pSQWjG9EzVts2K+y92SM/kCGWAnmU=; b=t1pFc8lfeEGgpKYicz1NmDcNJybqLgWazJpYgo6ipD0SIX8OlCoQyAH5D++LO2coYT W6+6+BeKBS8GLezJHeQz42h7FThdmf4FxBweIX7eKNaWeWLeqg5N83KuhTxlZVsB1N5W Pc+QpxIdRsJoJBr2HKcOrVJdlQc64mDx4F76/PPOYAm5h89I7xPWkoP/e9Dpt8RyT4Si zwyHXEQ22HZy7AaAP+YF7gfStot4oCwdBSHy2w/T52lB06R57qk4CDayi32W7H7LI7at Ex8UgQnrDoP3WQew4fn10m4zuky+X4yWdSfVbLdm5tWldJr0casUfN72aM/ajNRdynoY xmXw== X-Gm-Message-State: AOAM5314kzrDWzjzOPl0VggS7W3LFr/vNI+EneCaWJuvirx6AXICyeLo QA57AM9arPWSytOH3ShMyf4= X-Google-Smtp-Source: ABdhPJxVpRHhkGsH/y3B/Xrk7DV2vitzhYQU4rLo5u6bCuF10WpuP9XV+yuddhqr5tUKtMS+LCdI0w== X-Received: by 2002:a17:90a:6844:b0:1cb:a12d:40c3 with SMTP id e4-20020a17090a684400b001cba12d40c3mr10177825pjm.242.1649849674820; Wed, 13 Apr 2022 04:34:34 -0700 (PDT) Received: from jrouhaud (2001-b011-1005-f552-11af-c6c3-5701-767e.dynamic-ip6.hinet.net. [2001:b011:1005:f552:11af:c6c3:5701:767e]) by smtp.gmail.com with ESMTPSA id y7-20020a056a00180700b00506f420e62asm1823548pfa.11.2022.04.13.04.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Apr 2022 04:34:34 -0700 (PDT) Date: Wed, 13 Apr 2022 19:34:29 +0800 From: Julien Rouhaud To: Susanne Holzgraefe Cc: pgsql-bugs@lists.postgresql.org Subject: Re: replace() using NULL Message-ID: References: <29A17362-1756-422E-9BD3-2CBE9F8C990F@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <29A17362-1756-422E-9BD3-2CBE9F8C990F@web.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Wed, Apr 13, 2022 at 10:38:28AM +0200, Susanne Holzgraefe wrote: > > tested by using postgresql 13.5: > > SELECT REPLACE('xyz‘, ’y’, ’a’); => xaz => expected > SELECT REPLACE('xyz', 'a‘, 'b‘); => xyz => expected > > SELECT REPLACE('xyz‘, 'a‘, NULL); => NULL > > Also tested by using MariaDB. Same behavior like in PG. > Tested with Oracle, result is ‚xyz‘. > > That is what I would expect because xyz includes no a. > > I neither can find any documentation about this nor a bug report. The function is declared as STRICT, which means that it won't be called at all and just returns NULL if any of its parameters is NULL. Maybe oracle supports such calls as it supports NULL bytes in strings (I think), but postgres doesn't.