pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew Peter <survivedsushi@yahoo.com>
To: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: delete item[5] from varchar[] array???
Date: Fri, 23 Sep 2005 10:02:44 -0700 (PDT)
Message-ID: <20050923170244.72178.qmail@web35206.mail.mud.yahoo.com> (raw)
In-Reply-To: <20050922031511.GB90260@winnie.fuhr.org>



--- Michael Fuhr <mike@fuhr.org> wrote:

> On Wed, Sep 21, 2005 at 06:56:36PM -0700, Matthew
> Peter wrote:
> > How is it possible to delete an item from a single
> > dimension varchar[] array? Lets say it has the
> values
> > {1,2,3,4,5,6}... how do i delete at position [4]?
> 
> I'm not sure if there's a better way, but you could
> concatenate the
> slices adjacent to the position you want to delete:
> 
> test=> SELECT a FROM foo;
>        a       
> ---------------
>  {1,2,3,4,5,6}
> (1 row)
> 
> test=> UPDATE foo SET a = a[1:3] || a[5:6];
> UPDATE 1
> test=> SELECT a FROM foo;
>       a      
> -------------
>  {1,2,3,5,6}
> (1 row)
> 
> -- 
> Michael Fuhr
> 


I sure hope there is a better way :) There must be an
easy, native way to interface with arrays. We all know
programming languages have ways to delete items in an
array natively, it just needs to be exposed.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



view thread (7+ messages)  latest in thread

Message-ID: <20050923170244.72178.qmail@web35206.mail.mud.yahoo.com>
Permalink:  ../20050923170244.72178.qmail@web35206.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20050923170244.72178.qmail@web35206.mail.mud.yahoo.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: survivedsushi@yahoo.com, mike@fuhr.org
  Subject: Re: delete item[5] from varchar[] array???
  In-Reply-To: <20050923170244.72178.qmail@web35206.mail.mud.yahoo.com>

* 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