From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | Nacef LABIDI <nacef(dot)l(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: After updating dataset the record goes to the end of the dataset |
Date: | 2008-04-22 11:02:14 |
Message-ID: | 20080422110214.GA18721@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Padam J Singh | 2008-04-22 11:02:57 | Re: After updating dataset the record goes to the end of the dataset |
Previous Message | Pavan Deolasee | 2008-04-22 10:45:10 | Re: After updating dataset the record goes to the end of the dataset |