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 3BA8CDA14C for ; Thu, 22 Sep 2005 00:15:24 -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 10161-05 for ; Thu, 22 Sep 2005 03:15:18 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 83650DA13C for ; Thu, 22 Sep 2005 00:15:17 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j8M3FCXx056221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Sep 2005 21:15:14 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j8M3FCKY090314; Wed, 21 Sep 2005 21:15:12 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j8M3FCbv090313; Wed, 21 Sep 2005 21:15:12 -0600 (MDT) (envelope-from mfuhr) Date: Wed, 21 Sep 2005 21:15:12 -0600 From: Michael Fuhr To: Matthew Peter Cc: pgsql-sql@postgresql.org Subject: Re: delete item[5] from varchar[] array??? Message-ID: <20050922031511.GB90260@winnie.fuhr.org> References: <20050922015636.72033.qmail@web35205.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050922015636.72033.qmail@web35205.mail.mud.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200509/193 X-Sequence-Number: 22740 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