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 1fcVn2-0004Mk-R2 for pgsql-general@arkaria.postgresql.org; Mon, 09 Jul 2018 13:01:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fcVn1-0001QT-24 for pgsql-general@arkaria.postgresql.org; Mon, 09 Jul 2018 13:01:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fcVn0-0001QH-M3; Mon, 09 Jul 2018 13:01:14 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fcVmt-0005ik-Kg; Mon, 09 Jul 2018 13:01:13 +0000 Received: by fetter.org (Postfix, from userid 1001) id DD53941C71; Mon, 9 Jul 2018 15:01:05 +0200 (CEST) Date: Mon, 9 Jul 2018 15:01:05 +0200 From: David Fetter To: Brahmam Eswar Cc: pgsql-general Subject: Re: How to set array element to null value Message-ID: <20180709130105.GK22932@fetter.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Jul 09, 2018 at 03:28:45PM +0530, Brahmam Eswar wrote: > I'm trying to reset array element to null. You can do this in SQL as follows: SELECT ARRAY( SELECT CASE e WHEN 'ABC' THEN NULL ELSE e FROM UNNEST(x) _(e) ) This should really be going to pgsql-general because to is about how to use PostgreSQL, not how to change PostgreSQL. Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate