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 1nfQUn-0001EE-KT for pgsql-admin@arkaria.postgresql.org; Fri, 15 Apr 2022 18:16:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nfQUm-0008Oh-GR for pgsql-admin@arkaria.postgresql.org; Fri, 15 Apr 2022 18:16:36 +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 1nfQUm-0008OY-5w for pgsql-admin@lists.postgresql.org; Fri, 15 Apr 2022 18:16:36 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nfQUj-0008Py-PN for pgsql-admin@lists.postgresql.org; Fri, 15 Apr 2022 18:16:35 +0000 Received: by mail-ej1-x629.google.com with SMTP id bg10so16576199ejb.4 for ; Fri, 15 Apr 2022 11:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=h6u93ifaIB9It8PeL34oyDyO+NvdEwaEtL7e0tySsRg=; b=WShG4ZIXwBy3A+vy48P/nC2k6wtyLOiyrveuGtU3/6Vn8cI8o9y7QgroEETNzuf7rt KguDvg78QGt+8DRgUptSScrzhyYfS6++bINJMSdvi0UrZDbA/ybg8kxkizkWQxsoFaWS opVtN/vuvdId7Zmk/5FU5hUBTixtJNg4Hpvb0hSgHAYOdbt7Ip1sB48jgQpE6YciOalx d2cGDjIn1TZU19e2PwXV6JLFuZ2hwRvZuSOu48L8wTFfn2WzWhlBtkQj3rYmgm6tvoYW oSF/cnYhMQLyXfUHQTo45sxrow0l0th6meKO5ueUJDxSFWd3VoSFXMNxEiwyWEQbsnoY ZmCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=h6u93ifaIB9It8PeL34oyDyO+NvdEwaEtL7e0tySsRg=; b=PBeaxVg0cmNaE/2RbI/M5a1r6vXVijwNzs0L9z26cLAzwxJ1ItPdHQSxCyG3P+VJ9H hrijZ324BDXuiIkNF2/bo4qT+V0JbZ7kAnL8kF8bdiJn0OR+XIpqwVbEr/qUNtr2xMFC 7ABHHnoFMRhwocdXENNbdyj5W+tP6gykloVs8Q9LgqRvmfxACSR67LDGW0F3VXSwgh62 WjVhcUI+Bko0kIjBPfXJIyOnqoC9vKVTDrPcuWbXAp08D+ky1AWLKCRzQhbi2Qa+Boo0 kSjaly1Vur5SG5QLq0RdQjNZ+r8F38itsvTwoLarU3+Y13bHQdK9L9fvalerB0ZKOTEW lFDw== X-Gm-Message-State: AOAM530qv0+J7rOLGVZcjrqjSZrU6NHQLd7znIABD8faK0ePzzr0AoLT PklZYVe+cQwpgkCrDo3SbRv5VVQR/88cLlG9vXO+yGJ3 X-Google-Smtp-Source: ABdhPJzvkwAp8lG657gQuZpCbhSuGrr/7/L8izBJGQBxNOj/HVm48PLV+J3dP7RG+PQABUADKBCg9cbY0d/3ePsEgUo= X-Received: by 2002:a17:907:6093:b0:6e0:dabf:1a9f with SMTP id ht19-20020a170907609300b006e0dabf1a9fmr273880ejc.424.1650046591757; Fri, 15 Apr 2022 11:16:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:640c:28c5:b0:153:e47f:8e68 with HTTP; Fri, 15 Apr 2022 11:16:31 -0700 (PDT) In-Reply-To: <182146b5-7239-9fdb-1a17-2c16f306f76f@quadratum-braccas.com> References: <182146b5-7239-9fdb-1a17-2c16f306f76f@quadratum-braccas.com> From: "David G. Johnston" Date: Fri, 15 Apr 2022 11:16:31 -0700 Message-ID: Subject: Re: Having issues inserting a string with a ' into a varchar column To: Sbob Cc: Pgsql-admin Content-Type: multipart/alternative; boundary="000000000000f6f12705dcb56854" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000f6f12705dcb56854 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Friday, April 15, 2022, Sbob wrote: > > I tried this : quote_ident ( 'Poker 5 card Hold'Em') > > but it still error's out > > > I also tried : quote_literal('Poker 5 card Hold\'Em') > > but it also errors out: > > You have the right idea you need to escape it. But guessing isn=E2=80=99t = a good method to figure out how. https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-= CONSTANTS You can=E2=80=99t use quote_* on a literal if you do not express the litera= l correctly. David J. --000000000000f6f12705dcb56854 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Friday, April 15, 2022, Sbob <sbob@quadratum-braccas.com> wrote:

I tried this :=C2=A0 quote_ident ( 'Poker 5 card Hold'Em'= ;)

but it still error's out


I also tried :=C2=A0 quote_literal('Poker 5 card Hold\'Em')

but it also errors out:


You have the right idea you need to escape it.=C2=A0 But guessing isn=E2= =80=99t a good method to figure out how.


You can=E2=80=99t use= quote_* on a literal if you do not express the literal correctly.

David J.
=C2=A0
--000000000000f6f12705dcb56854--