Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPUbB-00ByCd-Le for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jan 2024 21:34:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rPUbA-000KmQ-R9 for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jan 2024 21:34:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPUbA-000KmI-EM for pgsql-hackers@lists.postgresql.org; Mon, 15 Jan 2024 21:34:24 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rPUb7-001zjZ-Ju for pgsql-hackers@postgresql.org; Mon, 15 Jan 2024 21:34:23 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1d45f182fa2so74583995ad.3 for ; Mon, 15 Jan 2024 13:34:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1705354459; x=1705959259; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=AzXYfKixGATWks4nZB08BllEnrsRdbExQI4wvjb54BI=; b=FMznbKOiUeXBvoYLAYlP8fPBCp2v+nH+x5LtPwWT/CUa2onqdUtPIs+GPfwtWDsE+l MNfUsxbmQPjuzvlfvmNiTQXK223XpeOdeVsogcZz/eBmA1eZuN/nvHxxsqYuxKRdRqKe Z+GcoS0jDGZNNS+aOSXBenQLgU3DNPvuu27ZCwMbQ2rymXFuS6rZo/vaCzhnMheikDqE NIssT+YU7rjCWBkSY0MS80I0+qXgsNfNSgNhgjXvWup4yCcvqatPxztNdy/4ruwaktYx yLxAVOzyQEKLzQXDg9c2fNlVOx1Vz00sT56Rf+F3CUjyenItJWTl+6dA1iWcf71BVPZ3 2Hcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705354459; x=1705959259; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=AzXYfKixGATWks4nZB08BllEnrsRdbExQI4wvjb54BI=; b=bdnO7M6mKVa12mAIQX1D+f2XSmYec4YeLbH1VGgyRrCU09FqjRPu+bayZSwc6yinUW DEvN6EDDXL7lzgNsXoFpcWlTf+V8zgJ/M6I8yyX90QCBYgoXo2Qa3DbxyP4jRX8dXw68 9MZrszleh7yXCya6kFN2OnEu/atHRj+t0I2oSX+UpbfJgnA4jwzCbq8IB/ASBkjSFbLG 8Ds3YSn+ohJNwhuEa/cZPmqXXMero1zXXOD2ICV1eC9FB/Y87cJsA/v8BBKD5IRnJ38L fEAUzKgCIsPhjZgUF4Vtwn0nGDZo6iu0tKu9qXxwPNnKi7P2z10go1S6SmYOxW5/OxL8 EGDA== X-Gm-Message-State: AOJu0YxryqDhnh4PXh6FVF1KBj1C3ec3Q9sL/mWmL3ahX2jQZble+SE9 rrXwYDYNI+0P8ynq8iEXaoG2L0ufMHZg X-Google-Smtp-Source: AGHT+IHzDOfuMdj6FtzcRsgDtOqxfHRqNgX9d+G2+T2x9moDY4v2wZhZerRWXVslp/o6AtR/r4Ryzg== X-Received: by 2002:a17:902:bc4c:b0:1d4:83d5:71a1 with SMTP id t12-20020a170902bc4c00b001d483d571a1mr6631238plz.110.1705354459321; Mon, 15 Jan 2024 13:34:19 -0800 (PST) Received: from [172.18.10.36] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id ku7-20020a170903288700b001d3fa5acf71sm8100303plb.12.2024.01.15.13.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 13:34:19 -0800 (PST) Message-ID: <9a235a36d71a50bff5c14dc14df40f5b1e703e2e.camel@j-davis.com> Subject: Re: [17] CREATE SUBSCRIPTION ... SERVER From: Jeff Davis To: Joe Conway , Ashutosh Bapat Cc: Bharath Rupireddy , pgsql-hackers@postgresql.org Date: Mon, 15 Jan 2024 13:34:18 -0800 In-Reply-To: References: <149ff9264db27cdf724b65709fbbaee4bf316835.camel@j-davis.com> <433d0845248e86c0317d9d396926182cfe157340.camel@j-davis.com> <05ae37abb207cd6bf6b126780024692d91402b0b.camel@j-davis.com> <93392ffa941ab0d436e19e0ab5d04d0e42c02d3f.camel@j-davis.com> <26be917cb07b6aa3ef5dd15f6b59d1b375ece6e8.camel@j-davis.com> <55201bd916e748acfc754c8f95880dae8e4e5ed0.camel@j-davis.com> <2a89b14a2b1622bffb8b137ca1f9ab7866f2d2b9.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2024-01-15 at 15:53 -0500, Joe Conway wrote: > I took a quick scan through the patch. The only thing that jumped out > at=20 > me was that it seems like it might make sense to use=20 > quote_literal_cstr() rather than defining your own > appendEscapedValue()=20 > function? The rules are slightly different. Libpq expects a connection string to escape only single-quote and backslash, and the escape character is always backslash: https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNSTRING-KEYW= ORD-VALUE quote_literal_cstr() has more complicated rules. If there's a backslash anywhere in the string, it uses the E'' form. If it encounters a backslash it escapes it with backslash, but if it encounters a single- quote it escapes it with single-quote. See: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRIN= GS https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRIN= GS-ESCAPE I'll include some tests and a better comment for it in the next patch set. Regards, Jeff Davis