Skip site navigation (1) Skip section navigation (2)

Re: User Defined Note Order Problem

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: operationsengineer1(at)yahoo(dot)com
Cc: PostGreSQL <pgsql-novice(at)postgresql(dot)org>
Subject: Re: User Defined Note Order Problem
Date: 2005-07-07 04:03:21
Message-ID: 20050707040321.GA13299@wolff.to (view raw or flat)
Thread:
Lists: pgsql-novice
Please don't reply to messages to start new threads.

On Wed, Jul 06, 2005 at 09:56:13 -0700,
  operationsengineer1(at)yahoo(dot)com wrote:
> i have an order column in my table to display
> instruction notes in the desired order.
> 
> one note is no problem - of course that note is first.
>  if only life stopped at one note! -lol-
> 
> adding a second note, though, is causing me some
> problems.  eg, the 2nd note may need to be displayed
> 1st or 2nd.  the code is pretty straight forward if it
> is to be displayed 2nd.
> 
> if the second note needs to be displayed first,
> though, the code is more challenging.
> 
> i will display both notes with  with the 2nd note
> coming 2nd.  the user will see the notes and then
> determine the newly entered note currently displayed
> 2nd will need to be displayed 1st.
> 
> i need to bump the order number +1 for every order
> number >= the required order number of newly entered
> note (in this specific case, that would be 1 b/c the
> first note is being bumped.  1+1 would leave order
> number 2 for the existing note and the newly entered
> note would have order number 1).

Another option is to use a "numeric" column to track ordering.
Then you can relatively easily insert a row between two existing
rows. This can still have problems if you have pathalogical cases
since numeric is limited to 1000 decimal digits. But under reasonable
usage patterns this should work pretty well.

In response to

pgsql-novice by date

Next:From: Michael FuhrDate: 2005-07-07 04:33:35
Subject: Re: PostgreSQL User-Defined Global Variables
Previous:From: Van Ingen, LaneDate: 2005-07-06 19:16:56
Subject: PostgreSQL User-Defined Global Variables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group