Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvUpP-0006nE-5e for pgsql-general@arkaria.postgresql.org; Wed, 07 Aug 2019 22:54:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hvUpN-000499-NW for pgsql-general@arkaria.postgresql.org; Wed, 07 Aug 2019 22:54:41 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvUpN-000491-Cj for pgsql-general@lists.postgresql.org; Wed, 07 Aug 2019 22:54:41 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hvUpK-0007rx-As for pgsql-general@lists.postgresql.org; Wed, 07 Aug 2019 22:54:41 +0000 Received: by mail-qt1-x830.google.com with SMTP id d23so90192672qto.2 for ; Wed, 07 Aug 2019 15:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=LQhYXdORoG4DZfLH2+B+5mwDjwSJH9jgvV1tNKtsN1Q=; b=PhCmiuIt1IlIxHVJnbV+hZ+/5L1sre3QrpRDpzlHfq4+5kBFOFdbsBYnhIa8i0+w0x 8jBVfKfBcIqx6imR/tR+rIQ9yVymESobMX+lnKuMoP493G/oyadOvbyzfbM6cW/TxBCw Qb/+Ul612Hyvapph86+tev+mdoJt/RjgqHvR06fILkWaR+7FNpz8dFuytcmdOq3wwVHd NtOacQkVbEx3NZtg9y/KImlQqFACX2mYNlCYuzxxO6IrzntzG5OOVifHUq6gRcvg1Lva vhh6VXEGxoV63LlZu1hGRWBmDxqKJ5Jp77d5AHtXXZBohmLzhnJt5fbQVQVCW6ntVQTd mlhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=LQhYXdORoG4DZfLH2+B+5mwDjwSJH9jgvV1tNKtsN1Q=; b=Bl8rl8VhyajXuAjg1VfWSXb3oB3pTmeVerT+BzVgiYoxJIcrry0z5hbs3Pn5AsCx28 lySp+YyQsQDXmtlEnKM/FCtDwpxrmvIJLvwS6CWwyu8pDsZ9TtwmTaSeNzvFF6IgqRJi cifxcOBVCiQZ1BWNB3InYA2sJiK5g+vWJ3NKEbZn+1KsDYDxJKJvibOKoNANDCmS6zVc VoEVIR8Nv0MQkFGJSyELFV7eEvdfnP/MZt4nAbKBzt8LCPek0BxFPv9l+/pz86ZlxSz1 wPTKPU+3dHpQQlYQZhu54jOAos9LS6cmqqaGyJ8qtdL9I06sGJu8DkzJKjaDjYPRuWn+ 5pVA== X-Gm-Message-State: APjAAAUQ6pRvcncFpo0Fg/Gk5FbF8btSn5oZ0yNMZWCCydTZUaeywsmo B+OWSTreZFCJ8hAeZZOoipNJFVpNTXCCUA== X-Google-Smtp-Source: APXvYqy29eDRunCTfIMk2rwuhLy9MF3rFxtrOSITsQQMHPuQGfwQ7MuyIpcm25rtaFuC7t8M0MQ8Nw== X-Received: by 2002:ac8:43c5:: with SMTP id w5mr10444964qtn.280.1565218475975; Wed, 07 Aug 2019 15:54:35 -0700 (PDT) Received: from [10.132.0.14] ([173.244.200.125]) by smtp.googlemail.com with ESMTPSA id i74sm2739754qke.133.2019.08.07.15.54.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 15:54:35 -0700 (PDT) Subject: Re: How to check if a field exists in NEW in trigger To: Michael Lewis Cc: pgsql-general References: <0cc87310-590f-740e-977d-bcdde57eef1b@lucee.org> <37107788-df16-ca5f-3193-6176fe40f282@gmx.net> From: "Igal @ Lucee.org" Message-ID: <1075832c-e131-474d-5d65-572004410838@lucee.org> Date: Wed, 7 Aug 2019 15:54:33 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/5/2019 11:34 AM, Michael Lewis wrote: > As a note to the original poster, you might want to check out- > > https://www.postgresql.org/docs/current/citext.html Thanks, Michael.  I'm familiar with the citext module. There is no reason, however, for an email address to be not-lower-cased, so while in some cases (no pun intended) it makes sense to keep the original CaSe while performing a case insensitive comparison, when it comes to email addresses I rather collapse the value upon insertion/update. Since that table has many more reads than writes, I am pretty sure that it's more performant too. Best, Igal