X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D6B1D8E55 for ; Fri, 23 Sep 2005 14:02:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19721-03 for ; Fri, 23 Sep 2005 17:02:48 +0000 (GMT) Received: from web35206.mail.mud.yahoo.com (web35206.mail.mud.yahoo.com [66.163.179.85]) by svr1.postgresql.org (Postfix) with SMTP id 40555D8D48 for ; Fri, 23 Sep 2005 14:02:44 -0300 (ADT) Received: (qmail 72180 invoked by uid 60001); 23 Sep 2005 17:02:44 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=4b6LO0l8QUYTJviyvn0K1enAepPnS9srUnwWmSiMCZRS8kgc/XbN19Dr2fGyA7OkibISuWN9CRMiY8Q8czBfQeYW/J6Si+qR9tegD5bXBHhIBblLHarzl2wzS6gCtObn8/L0LpGwJna7vYKjMxXHUGKQ2+naJOpLQYfUzmKfEjQ= ; Message-ID: <20050923170244.72178.qmail@web35206.mail.mud.yahoo.com> Received: from [70.104.144.58] by web35206.mail.mud.yahoo.com via HTTP; Fri, 23 Sep 2005 10:02:44 PDT Date: Fri, 23 Sep 2005 10:02:44 -0700 (PDT) From: Matthew Peter Subject: Re: delete item[5] from varchar[] array??? To: Michael Fuhr Cc: pgsql-sql@postgresql.org In-Reply-To: <20050922031511.GB90260@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.263 required=5 tests=[AWL=-0.111, DNS_FROM_RFC_ABUSE=0.374] X-Spam-Level: X-Archive-Number: 200509/233 X-Sequence-Number: 22780 --- Michael Fuhr 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