Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 937A79FB2D8 for ; Mon, 26 Feb 2007 14:15:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 87006-05 for ; Mon, 26 Feb 2007 14:14:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from zenon.apartia.fr (zenon.apartia.fr [82.66.93.83]) by postgresql.org (Postfix) with ESMTP id ABCE69FB2CF for ; Mon, 26 Feb 2007 14:14:53 -0400 (AST) Received: from trajan.apartia.fr (trajan.apartia.fr [10.0.3.121]) by zenon.apartia.fr (Postfix) with ESMTP id 67859F1252A19 for ; Mon, 26 Feb 2007 19:14:52 +0100 (CET) Received: by trajan.apartia.fr (Postfix, from userid 1000) id 42B52256EFF3; Mon, 26 Feb 2007 19:14:51 +0100 (CET) Date: Mon, 26 Feb 2007 19:14:51 +0100 From: Louis-David Mitterrand To: pgsql-sql@postgresql.org Subject: getting at sequence previous/next values Message-ID: <20070226181451.GA9015@apartia.fr> Mail-Followup-To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.341 tagged_above=0 required=5 tests=AWL, BAYES_50, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200702/269 X-Sequence-Number: 27603 Hello, I've got a table that looks basically like: id_show | serial show_name | text show_type | text created_on | timestamp without time zone When looking at a row with an id_show of value n, I'd like to have an easy way of knowing the preceding and next values of id_show in the sequence (which might have holes). Is there some convenient way to get that info, or must I do a full-blown select? Thanks,