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 1kWqRn-0005q6-19 for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Oct 2020 00:33:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kWqRj-0001zC-IV for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Oct 2020 00:33:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kWqRj-0001yS-5e for pgsql-hackers@lists.postgresql.org; Mon, 26 Oct 2020 00:33:11 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kWqRe-0007Qq-W6 for pgsql-hackers@lists.postgresql.org; Mon, 26 Oct 2020 00:33:09 +0000 Received: by mail-il1-x133.google.com with SMTP id x20so1360314ilj.8 for ; Sun, 25 Oct 2020 17:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=s9w58WHMFrrx9+F9+XGns0nE68zYfraZyYitKu/jPd0=; b=zA9yWt6ZNC37w0D9nSEldslht8EtKs8HYFSOTWVmBcWWZY6JZJNKM85946mQcJmNhn HNZ17vaRUPv0jvn0lsZR5auM3z7raj7Ius2iTDIqy7Mypk+ddJGgms4gFwLEHrp8Gxwo vF7X6inSJzIA7CY+jckMRI8MJ8xX7EtjPS1N23OVXkiwvWu1KgaDz6uowhAnvCJ/6ZJh L9eoUU9iy+/GmWGsS1I/oPN9h7vcL53m8hzJmMZNEMCleXlKBL+N68Q14aexpekZFxMS YRB4RMMKXDJqA/WB1jZ4LqC4ojOuWKF9RJ7X020nb+rjuUoO8bK+GCaxaod88lvI/buD Q5ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=s9w58WHMFrrx9+F9+XGns0nE68zYfraZyYitKu/jPd0=; b=e7kac+LLR9og4IJsQ/BdhXNjzE1Uusy3KpMTAUjCsoBNctHpCYIuk7XXhwiHqVNZz6 +NvWxcjLgYa3aZHCXNqVu2iTHsivUso1aqusp0aH4SmLvIaXPoZl2fZDpopHgoMIo3+e PbNLPulWGgWtvhQvGuuetjpJYrzXefUg5pbEIesYRzPWNYY7VS/wJvO5oA56WB3HphQ7 2PSISopYOBzoun/w+Lzj7G3QTuJ3tMrI80//qgaWjRMG9AmWCiyVRzG9Zf5mcX0uMy0U vQnii+pHhtLGZ5BShJujdxgJgAaFDwf2JWvx1fM8CB0dpv2nntpv18clJPh0GrUH2PIe r8sQ== X-Gm-Message-State: AOAM531Rqd1KTaIwwOmVYOwNFYlNt7OJ3plTcbx4drLvjv8BpX9fLyf4 Y2zGD6t3+b9Smg7FVxbY/7/2QQ== X-Google-Smtp-Source: ABdhPJzkDpA/d2xiqn/nSt/+UmloO2Wq511ZuEISigD2p7rp8xlosn2IwMIbA8wVy18hCq3zw4MIdg== X-Received: by 2002:a92:d248:: with SMTP id v8mr8478636ilg.297.1603672386184; Sun, 25 Oct 2020 17:33:06 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o13sm4578813iop.46.2020.10.25.17.33.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Oct 2020 17:33:05 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 260BD80067E; Sun, 25 Oct 2020 19:33:04 -0500 (CDT) Date: Sun, 25 Oct 2020 19:33:04 -0500 From: Justin Pryzby To: Maksim Kita Cc: Tom Lane , pgsql-hackers@lists.postgresql.org Subject: Re: Allow deleting enum value Message-ID: <20201026003303.GO9241@telsasoft.com> References: <20201007142656.GA181015@yetti> <2151250.1602084214@sss.pgh.pa.us> <2191224.1602086595@sss.pgh.pa.us> <20201007204707.GA210713@yetti> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201007204707.GA210713@yetti> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Oct 07, 2020 at 11:47:07PM +0300, Maksim Kita wrote: > I like the idea, during prototype I added additional column and modified > enum_in method. But enum_in is called in contexts that can be important > for user (like comparisons). ... > postgres=# ALTER TYPE test_enum DELETE VALUE '2'; > ALTER TYPE I think it should be called "DROP VALUE" > postgres=# SELECT * FROM test_table WHERE value = '2'; > ERROR: enum value is dropped test_enum: "2" > LINE 1: SELECT * FROM test_table WHERE value = '2'; This fails if the value was never added, so why wouldn't it also fail if the value is added and then removed ? Maybe you'd want to rename old enum names to something "unlikely", like what we do for dropped attributes in RemoveAttributeById. How do you want to handle "adding a value back" ? I think you should determine/propose/discuss the desired behaviors before implementing it. I think you'd also need to update these: src/bin/pg_dump/pg_dump.c src/bin/psql/describe.c src/bin/psql/tab-complete.c doc/src/sgml/catalogs.sgml src/test/regress/sql/enum.sql src/test/regress/expected/enum.out -- Justin