Re: After updating dataset the record goes to the end of the dataset

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: After updating dataset the record goes to the end of the dataset
Дата
Msg-id 20080422110214.GA18721@depesz.com
обсуждение исходный текст
Ответ на Re: After updating dataset the record goes to the end of the dataset  ("Nacef LABIDI" <nacef.l@gmail.com>)
Список pgsql-sql
On Tue, Apr 22, 2008 at 12:31:54PM +0200, Nacef LABIDI wrote:
> When I have tested this with SQLServer it works well, since the rows doesn't
> change position on the DB.
> I hope that you understand my issue and I will provide any explanations if
> someting isn't clear enough.

well. in postgresql rows do change position. and even in mssql depending
on position from table files is a very big mistake.

suggestion - add default "order by" by some id or timestamp column, and
modify it to fit your user preferences.

for example:

let's say that you have rows with ids: 1,2,3

by default you get them in order: 1,2,3.

if user wants to change the ordering to 2,3,1, store his preferences in
some other table and do it like this:

select t.* from table t join preferences p on t.id = p.id_in_table where
p.user = 'current user' order by p.ordering;

regards,

depesz



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

Предыдущее
От: "Pavan Deolasee"
Дата:
Сообщение: Re: After updating dataset the record goes to the end of the dataset
Следующее
От: Padam J Singh
Дата:
Сообщение: Re: After updating dataset the record goes to the end of the dataset