pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Fetter <david@fetter.org>
To: Brahmam Eswar <brahmam1234@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to set array element to null value
Date: Mon, 9 Jul 2018 15:01:05 +0200
Message-ID: <20180709130105.GK22932@fetter.org> (raw)
In-Reply-To: <CA+wLFo03Wp6sg8xWp+FyCFKW+5ec3kJ8uVz_Y3akEKyF5nRO4w@mail.gmail.com>
References: <CA+wLFo03Wp6sg8xWp+FyCFKW+5ec3kJ8uVz_Y3akEKyF5nRO4w@mail.gmail.com>

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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate




view thread (4+ messages)

Message-ID: <20180709130105.GK22932@fetter.org>
Permalink:  ../20180709130105.GK22932@fetter.org/
Also on:    postgresql.org/message-id/20180709130105.GK22932@fetter.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: david@fetter.org, brahmam1234@gmail.com
  Subject: Re: How to set array element to null value
  In-Reply-To: <20180709130105.GK22932@fetter.org>
  References: <CA+wLFo03Wp6sg8xWp+FyCFKW+5ec3kJ8uVz_Y3akEKyF5nRO4w@mail.gmail.com> <20180709130105.GK22932@fetter.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox