Re: How to set array element to null value

From: David Fetter <david(at)fetter(dot)org>
To: Brahmam Eswar <brahmam1234(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to set array element to null value
Date: 2018-07-09 13:01:05
Message-ID: 20180709130105.GK22932@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2018-07-09 13:05:09 Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Previous Message Christophe Courtois 2018-07-09 12:59:08 Oops... Re: Un peu décu : Re: Performance regression with PostgreSQL 11 and partitioning

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2018-07-09 13:04:22 Re: Cloning schemas
Previous Message Łukasz Jarych 2018-07-09 11:38:16 Create DDL trigger to catch which column was altered