From: hubert depesz lubaczewski <depesz@depesz.com>
To: Nacef LABIDI <nacef.l@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: After updating dataset the record goes to the end of the dataset
Date: Tue, 22 Apr 2008 13:02:14 +0200
Message-ID: <20080422110214.GA18721@depesz.com> (raw)
In-Reply-To: <f16f7ea00804220331u226df1ean9a17e12d9324e078@mail.gmail.com>
References: <f16f7ea00804220254i671e446au7c50dca45dea10d7@mail.gmail.com>
<3B256469-4A00-44C3-8EB8-F49FA9F7259A@scnat.ch>
<f16f7ea00804220310m26753072mec98ef0bc6bb2c9e@mail.gmail.com>
<20080422101523.GB17162@depesz.com>
<f16f7ea00804220331u226df1ean9a17e12d9324e078@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: depesz@depesz.com, nacef.l@gmail.com
Subject: Re: After updating dataset the record goes to the end of the dataset
In-Reply-To: <20080422110214.GA18721@depesz.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox