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 1i9UXq-0005Kv-OZ for pgsql-general@arkaria.postgresql.org; Sun, 15 Sep 2019 13:26:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i9UXp-0007qJ-Lc for pgsql-general@arkaria.postgresql.org; Sun, 15 Sep 2019 13:26:25 +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 1i9UXp-0007pq-8x for pgsql-general@lists.postgresql.org; Sun, 15 Sep 2019 13:26:25 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i9UXm-0007mn-Uq for pgsql-general@lists.postgresql.org; Sun, 15 Sep 2019 13:26:24 +0000 Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 46WVWd2gCPzqYG; Sun, 15 Sep 2019 09:26:21 -0400 (EDT) Received: by panix2.panix.com (Postfix, from userid 17622) id 46WVWd1TYtz1ZVT; Sun, 15 Sep 2019 09:26:21 -0400 (EDT) Date: Sun, 15 Sep 2019 09:26:21 -0400 From: stan To: Olivier Gautherot Cc: pgsql-general@lists.postgresql.org Subject: Re: Handling case variatiions on a user defined type? Message-ID: <20190915132621.GA24445@panix.com> References: <20190915123731.GA26465@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Editor: gVim User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Sep 15, 2019 at 09:58:45AM -0300, Olivier Gautherot wrote: > El dom., 15 de septiembre de 2019 09:37, stan escribi??: > > > I have several enumerated types that look like: > > > > CREATE TYPE confidence_level AS ENUM ('HIGH' , > > 'MEDIUM' , > > 'LOW' , > > 'WAG'); > > > > > > I have someone creating data for this project in spreadsheets, and then am > > importing the data using \copy. > > > > Problem is the data in the spreadsheets is entered in mixed case. > > > > Is there a way that I can use the type itself, to enforce something like a > > to_upper(). Or is there a better way to "human proof" this? > > > > -- > > "They that would give up essential liberty for temporary safety deserve > > neither liberty nor safety." > > -- Benjamin Franklin > > > > What about a trigger on INSERT, which would enforce the case? That sounds like a good idea, thanks. -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin