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 1obPNk-0001y4-Cg for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Sep 2022 16:49:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1obPNi-0000Ww-IW for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Sep 2022 16:48:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obPNi-0000W9-8w for pgsql-hackers@lists.postgresql.org; Thu, 22 Sep 2022 16:48:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obPNb-0007D3-RN for pgsql-hackers@lists.postgresql.org; Thu, 22 Sep 2022 16:48:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 28MGmloo1418392; Thu, 22 Sep 2022 12:48:47 -0400 From: Tom Lane To: Peter Eisentraut cc: Andres Freund , pgsql-hackers@lists.postgresql.org Subject: Re: Extending outfuncs support to utility statements In-reply-to: <1415326.1663863390@sss.pgh.pa.us> References: <4159834.1657405226@sss.pgh.pa.us> <9b197806-17ee-acba-0e70-01263aa46e79@enterprisedb.com> <1972439.1657665506@sss.pgh.pa.us> <2e7adbce-2ff5-866e-8753-9969b0ce332b@enterprisedb.com> <20220922153257.r5wj74prdqrucnov@awork3.anarazel.de> <1415326.1663863390@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 22 Sep 2022 12:16:30 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1418390.1663865327.1@sss.pgh.pa.us> Date: Thu, 22 Sep 2022 12:48:47 -0400 Message-ID: <1418391.1663865327@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > I think this is the issue Peter mentioned about needing to distinguish > between empty strings and NULL strings. We're going to need to rethink > the behavior of pg_strtok() a bit to fix that. After staring at the code a bit, I think we don't need to touch pg_strtok() per se. I propose that this can be resolved with changes at the next higher level. Let's make outToken print NULL as <> as it always has, but print an empty string as "" (two double quotes). If the raw input string is two double quotes, print it as \"" to disambiguate. This'd require a catversion bump when committed, but I don't think there are any showstopper problems otherwise. I'll work on fleshing that idea out. regards, tom lane