X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6681ED1C98E for ; Sat, 7 Feb 2004 10:47:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 13543-07 for ; Sat, 7 Feb 2004 06:47:48 -0400 (AST) Received: from mailstore-1.mail.knowledge.com (frida.london.knowtion.net [213.170.2.69]) by svr1.postgresql.org (Postfix) with ESMTP id F36F8D1B45B for ; Sat, 7 Feb 2004 06:47:41 -0400 (AST) Received: from [213.253.17.15] (helo=sonylaptop) by mailstore-1.mail.knowledge.com with asmtp (Exim 3.36 #1) id 1ApPzk-0004ig-00 for pgsql-sql@postgresql.org; Sat, 07 Feb 2004 10:47:28 +0000 Message-ID: <007101c3ed67$cdab35f0$24e0a8c0@sonylaptop> From: "Peter Galbavy" To: Subject: techniques for manual ordering of data ? Date: Sat, 7 Feb 2004 10:47:37 -0000 Organization: Knowtion Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/69 X-Sequence-Number: 16760 I tried googling, but the keywords here are so general, that I couldn't find much useful. I am looking for reommendations on how to build an ordered list of media (in this case photographs) in a particular "context". What I have - which I have somewhat simplified maually - is: CREATE TABLE contexts ( photo_id int8 REFERENCES photos ..., catalogue_id int8 REFERENCES catalogues ..., collection_id int8 REFERENCES collections ..., ordering int ); Here, a photograph may appear in multiple catalogue/collection places. What I want to do is to allow the admin to reorder the display by using + / - style buttons. My initial thought was to use an arbitrary "ordering" column, like old BASIC line numbers, which would be initially allocated in 10s or 100s, and then updating the value via the UI and occassionally applying a "renum" style function when the list gets uneven. To avoid performance hits through too many updates, I am trying to avoid the admin UI from UPDATEing all the rows in a specific catalogue/collection every time a button is pressed - both the SQL and the subsequent fragmented table. Hmm. Anyone got any "prior art" or suggestions on how they acheive this ? Note that I am NOT including ordering based on an photograph specific metadata like time or location. That's another story and another interface. rgds, -- Peter