Re: User Defined Note Order Problem

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: User Defined Note Order Problem
Дата
Msg-id 20050707040321.GA13299@wolff.to
обсуждение исходный текст
Ответ на User Defined Note Order Problem  (<operationsengineer1@yahoo.com>)
Список pgsql-novice
Please don't reply to messages to start new threads.

On Wed, Jul 06, 2005 at 09:56:13 -0700,
  operationsengineer1@yahoo.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.

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Van Ingen, Lane"
Дата:
Сообщение: PostgreSQL User-Defined Global Variables
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: PostgreSQL User-Defined Global Variables