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 1iADqL-0006Jz-Pw for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2019 13:48:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iADqK-0003ic-Lz for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2019 13:48:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iADqK-0003iN-8w for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2019 13:48:32 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iADqH-0006FH-2Y for pgsql-general@postgresql.org; Tue, 17 Sep 2019 13:48:31 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B2B0D21FE6; Tue, 17 Sep 2019 09:48:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 17 Sep 2019 09:48:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=Z x3JNjCHgoPOJUf95hnlIIg8kwtVL2085N1D7gngkZA=; b=hWPN5lifv9XkQ5dwX OA86dJ4AY3Wnm3iJqdRYfqbvoR44EZOrLDIv0G/EZR1aZjJx7LT9Iu6wNIe5vIFC G7pj5A7bpxPNfpRGzulygdNeROUroIV/u2/RsUJn2dwyscSso2EXPX/+k11RsDpv 18zeXB5p8Q+k7YVXEzu/+ZI1tmDT+Id94zvkoO5j2aADq8AJEjI9G7xXDyTN9Dql lm70J7SAuzLTmjIgcg/cEMR6v21GYITxXBLDDVkSN06pZJC9MbaEhAY2rtiEfd4K sFSk3Xdg3g8oe0FcA3yShE2bfd1zLZgnNvWbN2I4Nu1nThKvc6gsf7IQVidSXCYp +WeSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Zx3JNjCHgoPOJUf95hnlIIg8kwtVL2085N1D7gngk ZA=; b=S9eeo3Tdjc3UdbctRZOits7ROEdWflkhI4+8Zxm82rOZsQqOn/bKD2c2a YPrfMxJ7fTsW4u3RqKgu3FzMMFtTqgiKN6PK950CXw+CTLPr+fQY6G7XRBa8aE1X SsI6zajxHV78KkAr+0nWCw9/WWwvBOd+Ts8BlSvBm+czcsxzpjZWshcXRt/9XzAj AajJ2ttldTx9mqxo/VQWsVYtUSMtiHcfotvi+7qAZmx+3ULQczuC/dQl0AA1Enxh cGaAy1xVPSDotldwyCctRfOineS8NEaa51qM0c+iN5ZgG7HfEP7M39eIaNtObnoV 8y0RXV2e1psoBO/huR32JlxQmdDVQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeigdegvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthejre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucfkphepudejgedrvddurdduvdelrdduje ehnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhl rghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.3] (174-21-129-175.tukw.qwest.net [174.21.129.175]) by mail.messagingengine.com (Postfix) with ESMTPA id 8367280066; Tue, 17 Sep 2019 09:48:26 -0400 (EDT) Subject: Re: FW: Re: FW: Re: Shouldn;t this trigger be called? To: stan Cc: pgsql-general@postgresql.org References: <20190915174649.GB2078@panix.com> <50d5b256-74b9-1949-a634-0df37cbfb783@aklaver.com> <20190916010439.GA7478@panix.com> <11b4428d-8740-07f4-a053-37f0bb0cd2fb@aklaver.com> <20190916185333.GB28966@panix.com> <20190916195543.GA16882@panix.com> <4b1da094-8342-6415-e0a4-ce87fd1331ab@aklaver.com> <20190917093126.GA935@panix.com> From: Adrian Klaver Message-ID: <699cb705-0609-c830-b6c3-3a4aa9bc2e58@aklaver.com> Date: Tue, 17 Sep 2019 06:48:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190917093126.GA935@panix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/17/19 2:31 AM, stan wrote: >>> I am not certain what you mean by the check. As you can see, there is nor >>> specific check clause. I was referring to the built in check of data being >>> entered versus the legal values for the user defined type. Make sense? >>> >> >> To be clear you are seeing an error because a value of say 'active' is being >> rejected before your trigger has a chance to upper case it, correct? >> >> Also this happens whether you use \copy or manually INSERT the values? > > That is correct. Sorry this was not clear from the beginning. > > Any suggestions, including changing the design here, are welcome. Suggestions: 1) Per Tom's post clean the data before it hits the database. 2) Enter the data directly into the database using something that forces the user to enter only the correct ENUM values. 3) If the status field is only ever going to be ACTIVE/INACTIVE change it to a BOOLEAN field active_status and be done with the ENUM dance. 4) If status may ever be more then ACTIVE/ACTIVE then change it to varchar and use the trigger to set case(if still important) and/or verify correct entries. -- Adrian Klaver adrian.klaver@aklaver.com