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 1lwkEp-0001Xe-Fl for pgsql-general@arkaria.postgresql.org; Fri, 25 Jun 2021 11:43:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwkEo-0002jg-FT for pgsql-general@arkaria.postgresql.org; Fri, 25 Jun 2021 11:43:10 +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 1lwkEo-0002jY-3C for pgsql-general@lists.postgresql.org; Fri, 25 Jun 2021 11:43:10 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lwkEl-00016v-Kc for pgsql-general@lists.postgresql.org; Fri, 25 Jun 2021 11:43:09 +0000 Received: by mail-ej1-x636.google.com with SMTP id bu12so14738513ejb.0 for ; Fri, 25 Jun 2021 04:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=E7pq3QwV71CGgC0cieWPTt9EONYPhsuLEkNwjySSJIw=; b=zGzli6WWOjoAaY5FUNTDjWwnHeAHlbn+XLosnJxgcfz4a6dUOj8yuzYBOa4bFWXdk/ U9YZEmZXEoKyxnu0pj3/uuOfeGdgLYj7FlKqxYi1ctxgbbXdlOMUU3lqIvl3JsTyN9TI Y3Qg+CJLQFiX5DY8S82pOk3nPkokZriP+6KQOMCBA73gJmRYShYJcqkM2/o1KxdyyrMq gPet/JSO3nR3A5+GATg6Fo0KuNyWQqfEQ/9ctUy3p3X7Z9H4z8fJR2BvUCZK4JBfr5VO A1Sy378WhN7XVbwnIFimCQj1BIYdSKNEebDLERwR+Zt/snK6DxbLKn/p7W0zqFR6ZWdy mDBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=E7pq3QwV71CGgC0cieWPTt9EONYPhsuLEkNwjySSJIw=; b=LMSNePf2P3vYd+wpEHWqbEIHBbzXWFTwujxOyCAPVFFSAXG2veLDKNv+4EZGHsKCMH YdmgBmzSBGmVvgMgiy0fi63ajfuCoK0NZrlKmU8h0RpKq8xywZ/nkByQSkcIhWxWXR+v g9vkwVtTrSIQwLcq7AJMaxCUgBE37dGq7wVEbP7d6OG988MVMGtBA4e2b7ISA55VVUoC FCJWKk7eJgaIUDv7qk2bo1haHhBctBOBB4ne8QLxY1W0Hvej1APIijWSLEV/mQe3UXNU cWjDMX83BcJY/jjItQN9rxQR+Y1LA1T10gAyUNColjAptP1P6LP4wKhkZBG2cTtgd0VC eghQ== X-Gm-Message-State: AOAM532iSBPIzRGjfCaP7uEp22aJU1hqKvHIv/LhNrbCS7OV9Mp3JW16 BDi2ABIEwVZV2cwaChnLUGK93g== X-Google-Smtp-Source: ABdhPJyMXgOKYPif8RHKpCCVB3HJpjxabZlydnGJ7LPrCDkicTqhTCR+pOABZfpK7C5Pjp2FYo985g== X-Received: by 2002:a17:906:1c84:: with SMTP id g4mr10004336ejh.99.1624621385993; Fri, 25 Jun 2021 04:43:05 -0700 (PDT) Received: from localhost.localdomain (217-149-168-6.nat.highway.telekom.at. [217.149.168.6]) by smtp.gmail.com with ESMTPSA id em22sm2187840ejc.57.2021.06.25.04.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 04:43:05 -0700 (PDT) Message-ID: <7755cbb6a96ebab699d52f7801f799fb9815cd8a.camel@cybertec.at> Subject: Re: Difference between text_pattern_ops and varchar_pattern_ops From: Laurenz Albe To: David Morgenstern , pgsql-general@lists.postgresql.org Date: Fri, 25 Jun 2021 13:43:05 +0200 In-Reply-To: <2EA363D8-E6F2-4EBF-9A74-BECBBF81B76E@synedra.com> References: <2EA363D8-E6F2-4EBF-9A74-BECBBF81B76E@synedra.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2021-06-25 at 12:29 +0200, David Morgenstern wrote: > The documentation for operator classes (https://www.postgresql.org/docs/current/indexes-opclass.html) > seems to indicate that text_pattern_ops should only be used for text columns > and varchar_pattern_ops should be used for varchar columns. > However today I stumbled upon an index using text_pattern_ops on a varchar column. > Everything seems to be working fine. Now I am wondering what the difference > between text_pattern_ops and varchar_pattern_ops might be. > > Can somebody explain why text_pattern_ops can be used on varchar columns, considering it > can’t be used for bpchar columns? And are there any downsides in doing this > (aside from my confusion of course)? https://www.postgresql.org/message-id/flat/A737B7A37273E048B164557ADEF4A58B17CCE003%40ntex2010i.host.magwien.gv.at Yours, Laurenz Albe -- +43-670-6056265 CYBERTEC PostgreSQL International GmbH Gröhrmühlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com