Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g8ygx-0003vV-G0 for pgsql-sql@arkaria.postgresql.org; Sun, 07 Oct 2018 02:21:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g8ygs-0001MT-Rg for pgsql-sql@arkaria.postgresql.org; Sun, 07 Oct 2018 02:21:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g8ygs-0001MK-Hb for pgsql-sql@lists.postgresql.org; Sun, 07 Oct 2018 02:21:06 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g8ygm-0003cQ-3D for pgsql-sql@lists.postgresql.org; Sun, 07 Oct 2018 02:21:05 +0000 Received: by mail-pl1-x643.google.com with SMTP id 1-v6so8501234plv.7 for ; Sat, 06 Oct 2018 19:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paulmcgarry-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=89dDoL5NhN1SeEzG2efWEuRxv2MsYP+QqPzlfZXgIX0=; b=vZq2O7e6Lu+X2N8TVtTML0g9J5A/XlmrrhWR5IkiGSWkCnf5B6RWxtf/h+1kh8iwni n3Zni70LY88xXsOtYKJw4819DBEHsx67h7mSwVIyq3b6HJAWGPk9c0QfdVykRIVfjUdF VtoIg9bNmwfKx1GaAyh9NYMR7iaQBP8kyTQtiDqORkD2cAKSqwg6/Eshl9gqsioms+rR VfJ7val8pMphpGZJcRpqmxHSgrE9/dNkHZfg2V3R+o0U0BlK9UhWi/vkU8/qg53zBoUz BpMzzQmGtq5v59Tf/Q3417OQghDepvjgcAa9NGDTqYD8mVfTFdMceIlstG7/hcbyhmXu xoCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=89dDoL5NhN1SeEzG2efWEuRxv2MsYP+QqPzlfZXgIX0=; b=RYl2I+aYnuj97Lcjgwf+28P/LGV+oN5bZmVjVPiWh6jA4KpFTgbF2LMXykCDzCZk+z 3uBIOmuV9J4eL3GjuwWxrDJ+fPp0+EueVjrdOuAaw93ReZO6nxbuhayK38KeRcxMMmjl yxi2syVhhIRmiBS75hDpjyzJWZw+wEbEhmJqgnOvnV493hTqRiPEu6BfDcc3x3Puol5M 3HERYK2WPUG73wR/JXbm9KVea8aNnJ7SB32Nki61XMqibEdfA1KfSWT5WBVEW0kBwmpj QqLBwKp4+Zt4T8On0pJeM1QTncVVVfMpyWbtKOVmWzA8+PlHDAeG9hJN/pNX8xqt9hWI EM3g== X-Gm-Message-State: ABuFfogYip3kZOkJxLVkvZ67DfcR4RrLrvgonKJpibOwPLklCWIL3DbE A0bUBUo300hRd0HjmcWQGswaFIlzpMWid+26 X-Google-Smtp-Source: ACcGV62bgZuJUFb7A0nHeTcNJtqLxdxnu/sWotIrrHurEa6w/QYvH5znEJ+2yJ41iMjvxQklv4bQpw== X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr1589556plh.137.1538878857511; Sat, 06 Oct 2018 19:20:57 -0700 (PDT) Received: from [192.168.1.110] (27-32-79-177.static.tpgi.com.au. [27.32.79.177]) by smtp.gmail.com with ESMTPSA id p62-v6sm20401383pfp.111.2018.10.06.19.20.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Oct 2018 19:20:56 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-610C1721-88B4-40D3-8938-8608848C49F9 Mime-Version: 1.0 (1.0) Subject: Re: Why the index is not used ? From: Paul McGarry X-Mailer: iPhone Mail (16A366) In-Reply-To: Date: Sun, 7 Oct 2018 13:20:53 +1100 Cc: "pgsql-sql@lists.postgresql.org" , "pgsql-performance@lists.postgresql.org" , "pgsql-general@lists.postgresql.org" Content-Transfer-Encoding: 7bit Message-Id: References: To: ROS Didier List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail-610C1721-88B4-40D3-8938-8608848C49F9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I haven=E2=80=99t looked up what pgp_sym_encrypt() does but assuming it does= encryption the way you should be for credit card data then it will be using= a random salt and the same input value won=E2=80=99t encrypt to the same ou= tput value so =3D=3D=3D=3D WHERE cc=3Dpgp_sym_encrypt('test value 32', 'motdepasse'); =3D=3D=3D=3D wouldn=E2=80=99t work because the value generated by the function when you a= re searching on isn=E2=80=99t the same value as when you stored it. Paul > On 6 Oct 2018, at 19:57, ROS Didier wrote: >=20 > WHERE cc=3Dpgp_sym_encrypt('test value 32', 'motdepasse'); --Apple-Mail-610C1721-88B4-40D3-8938-8608848C49F9 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
I haven=E2=80=99t looked up what pgp_s= ym_encrypt() does but assuming it does encryption the way you should be for c= redit card data then it will be using a random salt and the same input value= won=E2=80=99t encrypt to the same output value so
=3D=3D=3D=3D
WHERE cc=3Dpgp_sym_encry= pt('test value 32', 'motdepasse');
=3D=3D=3D=3D
wouldn=E2=80=99t work because the value generated by the function when= you are searching on isn=E2=80=99t the same value as when you stored it.



Paul
<= br>On 6 Oct 2018, at 19:57, ROS Didier <didier.ros@edf.fr> wrote:

=
WHERE cc=3Dpgp_sym_= encrypt('test value 32', 'motdepasse');
= --Apple-Mail-610C1721-88B4-40D3-8938-8608848C49F9--