pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedAfter updating dataset the record goes to the end of the dataset
13+ messages / 9 participants
[nested] [flat]
* After updating dataset the record goes to the end of the dataset
@ 2008-04-22 09:54 Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:11 ` Re: After updating dataset the record goes to the end of the dataset Thomas Kellerer <spam_eater@gmx.net>
2008-04-22 10:12 ` Re: After updating dataset the record goes to the end of the dataset Gurjeet Singh <singh.gurjeet@gmail.com>
0 siblings, 3 replies; 13+ messages in thread
From: Nacef LABIDI @ 2008-04-22 09:54 UTC (permalink / raw)
To: pgsql-sql
Hi all,
I am using Postgres in a Delphi application through ODBC. I am having an
issue with updating records.
When I create a dataset to get the records in a table then after I update
one of these records and then refresh the dataset, the record goes to the
end of the dataset. This is disappointing when editing records on a DBGrid,
where users find their updated records jump to the end of the grid. Even
after restarting the application, the updated record keeps showing at the
end of the grid. I have tried the same thing with SQL Server and it works
normally, so I thought it was a postgres behvior.
Has anyone an idea about what could be the cause of such a behavior.
Thanks to all in advance.
Nacef
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 10:10 ` Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:15 ` Re: After updating dataset the record goes to the end of the dataset hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 12:46 ` Re: After updating dataset the record goes to the end of the dataset Craig Ringer <craig@postnewspapers.com.au>
2 siblings, 2 replies; 13+ messages in thread
From: Nacef LABIDI @ 2008-04-22 10:10 UTC (permalink / raw)
To: Roland Voegtli <voegtli@scnat.ch>; pgsql-sql
Yes I don't issue any sort statement, and I indeed want the data to be show
as it is stored in the database. But after updating a row (I don't update
the ID, just some fields), it keeps its same place on the DB but jumps to
the end of the dataset and by the way to the end of the DBGrid.
Nacef
On Tue, Apr 22, 2008 at 12:06 PM, Roland Voegtli <voegtli@scnat.ch> wrote:
> Has anyone an idea about what could be the cause of such a behavior.
> >
>
> You don't issue any sort statement with the query, obviously. So you get
> the records the way they are stored in the database.
>
> cheers
> (R)
>
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 10:15 ` hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 10:31 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
1 sibling, 1 reply; 13+ messages in thread
From: hubert depesz lubaczewski @ 2008-04-22 10:15 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; +Cc: Roland Voegtli <voegtli@scnat.ch>; pgsql-sql
On Tue, Apr 22, 2008 at 12:10:41PM +0200, Nacef LABIDI wrote:
> Yes I don't issue any sort statement, and I indeed want the data to be show
> as it is stored in the database. But after updating a row (I don't update
> the ID, just some fields), it keeps its same place on the DB but jumps to
> the end of the dataset and by the way to the end of the DBGrid.
why do you think it stays in the same place in db?
besides - without "order by" you cannot depend on the order of rows.
basically i treat them as in "random" order (which is not true, but
helps me remember to never count on the "default" ordering.
depesz
--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:15 ` Re: After updating dataset the record goes to the end of the dataset hubert depesz lubaczewski <depesz@depesz.com>
@ 2008-04-22 10:31 ` Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:45 ` Re: After updating dataset the record goes to the end of the dataset Pavan Deolasee <pavan.deolasee@gmail.com>
2008-04-22 11:02 ` Re: After updating dataset the record goes to the end of the dataset hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 11:02 ` Re: After updating dataset the record goes to the end of the dataset Padam J Singh <padam.singh@inventum.cc>
0 siblings, 3 replies; 13+ messages in thread
From: Nacef LABIDI @ 2008-04-22 10:31 UTC (permalink / raw)
To: depesz@depesz.com; +Cc: Roland Voegtli <voegtli@scnat.ch>; pgsql-sql
You are right about the fact that the rows don't keep the order they where
created with at the start. I have verfied this.
I will explain more my case :
I am writing an application where here is some resources to plan events on.
I want to provide the user with the ability to customize the order in which
resources are displayed on the screen. So there is a mapping between the
rows positions in the dataset and they display positions. After updating one
of these resources the row jumps to the end of the dataset so does the
resource on the display. And the order gets scrambled. I cannot set this
order in the databe since it is customizable for each user.
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.
Thanks to all
Nacef
On Tue, Apr 22, 2008 at 12:15 PM, hubert depesz lubaczewski <
depesz@depesz.com> wrote:
> On Tue, Apr 22, 2008 at 12:10:41PM +0200, Nacef LABIDI wrote:
> > Yes I don't issue any sort statement, and I indeed want the data to be
> show
> > as it is stored in the database. But after updating a row (I don't
> update
> > the ID, just some fields), it keeps its same place on the DB but jumps
> to
> > the end of the dataset and by the way to the end of the DBGrid.
>
> why do you think it stays in the same place in db?
>
> besides - without "order by" you cannot depend on the order of rows.
> basically i treat them as in "random" order (which is not true, but
> helps me remember to never count on the "default" ordering.
>
> depesz
>
> --
> quicksil1er: "postgres is excellent, but like any DB it requires a
> highly paid DBA. here's my CV!" :)
> http://www.depesz.com/ - blog dla ciebie (i moje CV)
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:15 ` Re: After updating dataset the record goes to the end of the dataset hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 10:31 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 10:45 ` Pavan Deolasee <pavan.deolasee@gmail.com>
2 siblings, 0 replies; 13+ messages in thread
From: Pavan Deolasee @ 2008-04-22 10:45 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; +Cc: depesz@depesz.com, "Roland Voegtli" <voegtli@scnat.ch>; pgsql-sql
On Tue, Apr 22, 2008 at 4:01 PM, Nacef LABIDI <nacef.l@gmail.com> wrote:
>
> I am writing an application where here is some resources to plan events on.
> I want to provide the user with the ability to customize the order in which
> resources are displayed on the screen.
To hope that the database would do that automatically for you is IMHO
wrong. One way I can think of is to store the ordering information
along with the user and then fetch the items in the desired order
while displaying. Isn't that what you would anyway require if there
are multiple users and each one wants to see the items in a different
order ?
Thanks,
Pavan
--
Pavan Deolasee
EnterpriseDB http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:15 ` Re: After updating dataset the record goes to the end of the dataset hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 10:31 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 11:02 ` hubert depesz lubaczewski <depesz@depesz.com>
2 siblings, 0 replies; 13+ messages in thread
From: hubert depesz lubaczewski @ 2008-04-22 11:02 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; +Cc: 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
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:15 ` Re: After updating dataset the record goes to the end of the dataset hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 10:31 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 11:02 ` Padam J Singh <padam.singh@inventum.cc>
2 siblings, 0 replies; 13+ messages in thread
From: Padam J Singh @ 2008-04-22 11:02 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; +Cc: depesz@depesz.com, Roland Voegtli <voegtli@scnat.ch>; pgsql-sql
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000066">
<font size="-1"><font face="Helvetica, Arial, sans-serif">Nacef,<br>
<br>
Simply add a SERIAL column to your table. When you add a new row, a new
value will be stored in this column if you do not specify the column
name in the insert query.<br>
In your select query, always order by this column.<br>
When doing an update , do not update this column. When re-ordering,
update this column to indicate order. So if you want to move a row up,
issue two update queries, updating this column. Make sure you have some
primary key in this table to uniquely identify these row.<br>
<br>
Never rely on the internal implementation of a database to keep the
data in the order you insert/update.<br>
<br>
Padam<br>
</font></font><br>
Nacef LABIDI wrote:
<blockquote
cite="mid:f16f7ea00804220331u226df1ean9a17e12d9324e078@mail.gmail.com"
type="cite">You are right about the fact that the rows don't keep the
order they where created with at the start. I have verfied this.<br>
<br>
I will explain more my case :<br>
<br>
I am writing an application where here is some resources to plan events
on. I want to provide the user with the ability to customize the order
in which resources are displayed on the screen. So there is a mapping
between the rows positions in the dataset and they display positions.
After updating one of these resources the row jumps to the end of the
dataset so does the resource on the display. And the order gets
scrambled. I cannot set this order in the databe since it is
customizable for each user.<br>
<br>
When I have tested this with SQLServer it works well, since the rows
doesn't change position on the DB.<br>
<br>
I hope that you understand my issue and I will provide any explanations
if someting isn't clear enough.<br>
<br>
Thanks to all<br>
Nacef<br>
<br>
<div class="gmail_quote">On Tue, Apr 22, 2008 at 12:15 PM, hubert
depesz lubaczewski <<a moz-do-not-send="true"
href="mailto:depesz@depesz.com">depesz@depesz.com</a>> wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Tue, Apr 22, 2008 at 12:10:41PM +0200, Nacef
LABIDI wrote:<br>
> Yes I don't issue any sort statement, and I indeed want the data
to be show<br>
> as it is stored in the database. But after updating a row (I don't
update<br>
> the ID, just some fields), it keeps its same place on the DB but
jumps to<br>
> the end of the dataset and by the way to the end of the DBGrid.<br>
<br>
</div>
why do you think it stays in the same place in db?<br>
<br>
besides - without "order by" you cannot depend on the order of rows.<br>
basically i treat them as in "random" order (which is not true, but<br>
helps me remember to never count on the "default" ordering.<br>
<br>
depesz<br>
<font color="#888888"><br>
--<br>
quicksil1er: "postgres is excellent, but like any DB it requires a<br>
highly paid DBA. here's my CV!" :)<br>
<a moz-do-not-send="true" href="http://www.depesz.com/";
target="_blank">http://www.depesz.com/</a; - blog dla ciebie (i moje
CV)<br>
</font></blockquote>
</div>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
PGP Id 9EED2E09</pre>
</body>
</html>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 12:46 ` Craig Ringer <craig@postnewspapers.com.au>
2008-04-22 12:56 ` Re: After updating dataset the record goes to the end of thedataset Bart Degryse <Bart.Degryse@indicator.be>
1 sibling, 1 reply; 13+ messages in thread
From: Craig Ringer @ 2008-04-22 12:46 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; +Cc: Roland Voegtli <voegtli@scnat.ch>; pgsql-sql
Nacef LABIDI wrote:
> Yes I don't issue any sort statement, and I indeed want the data to be show
> as it is stored in the database.
That's what you're getting. PostgreSQL has an MVCC design. How it works
in general terms
(simplified, but I lack the expertise to give a complete explanation
even if one was required) is:
When you update a row the old row is marked as dead and a new row is
inserted. If there is no
spare space in the table near the old row (assuming there's any reason
for the DB to even try
to put the new row near the old one) then the new row will be placed
elsewhere, such as at
the end of the table.
In other words, after an UPDATE the row really is often at the end of
the table.
In any case as others have explained you should never rely on the
database ordering
of records; you should always use an ORDER BY if you care about order.
The database
makes no guarantees about the order of returned rows.
The database may optimise row retrieval in ways you do not expect. For
example,
in recent versions of PostgreSQL if there is a sequential scan in
progress on a table
and you start another query that also runs a sequential scan on the
table, PostgreSQL
may synchronize the two scans. That'll cause your query to start part
way through the
table. If the table contains alphabetically ordered data you might get
something like:
J
K
L
M
... etc ...
A
B
C
So ... in any database, always use ORDER BY if you care about order.
Just because it usually
works in some databases doesn't mean it won't break just rarely enough
to drive you insane
while debugging...
--
Craig Ringer
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of thedataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 12:46 ` Re: After updating dataset the record goes to the end of the dataset Craig Ringer <craig@postnewspapers.com.au>
@ 2008-04-22 12:56 ` Bart Degryse <Bart.Degryse@indicator.be>
2008-04-22 13:00 ` Re: After updating dataset the record goes to the end of thedataset Nacef LABIDI <nacef.l@gmail.com>
0 siblings, 1 reply; 13+ messages in thread
From: Bart Degryse @ 2008-04-22 12:56 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; Craig Ringer <craig@postnewspapers.com.au>; +Cc: pgsql-sql; Roland Voegtli <voegtli@scnat.ch>
Probably what you mean is that you want the order in which the records were
originally inserted into the database. In that case add a serial to your table and
fetch the records like
SELECT * FROM tbl WHERE 1=1 ORDER BY [myserialfield]
It's not foolproof but will in many cases come close to what you seem to be trying
to achieve by not using 'order by'.
Nacef LABIDI wrote:
> Yes I don't issue any sort statement, and I indeed want the data to be show
> as it is stored in the database.
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of thedataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 12:46 ` Re: After updating dataset the record goes to the end of the dataset Craig Ringer <craig@postnewspapers.com.au>
2008-04-22 12:56 ` Re: After updating dataset the record goes to the end of thedataset Bart Degryse <Bart.Degryse@indicator.be>
@ 2008-04-22 13:00 ` Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 15:16 ` Re: After updating dataset the record goes to the end of thedataset Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 1 reply; 13+ messages in thread
From: Nacef LABIDI @ 2008-04-22 13:00 UTC (permalink / raw)
To: Bart Degryse <Bart.Degryse@indicator.be>; +Cc: Craig Ringer <craig@postnewspapers.com.au>; pgsql-sql@postgresql.org, "Roland Voegtli" <voegtli@scnat.ch>
Thank you all for your useful comments.
I have tried to order my records as you said and got it work as I wanted.
Thank you again
On Tue, Apr 22, 2008 at 2:56 PM, Bart Degryse <Bart.Degryse@indicator.be>
wrote:
> Probably what you mean is that you want the order in which the records
> were
> originally inserted into the database. In that case add a serial to your
> table and
> fetch the records like
> SELECT * FROM tbl WHERE 1=1 ORDER BY [myserialfield]
> It's not foolproof but will in many cases come close to what you seem to
> be trying
> to achieve by not using 'order by'.
>
> Nacef LABIDI wrote:
> > Yes I don't issue any sort statement, and I indeed want the data to be
> show
> > as it is stored in the database.
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of thedataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Re: After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 12:46 ` Re: After updating dataset the record goes to the end of the dataset Craig Ringer <craig@postnewspapers.com.au>
2008-04-22 12:56 ` Re: After updating dataset the record goes to the end of thedataset Bart Degryse <Bart.Degryse@indicator.be>
2008-04-22 13:00 ` Re: After updating dataset the record goes to the end of thedataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 15:16 ` Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 0 replies; 13+ messages in thread
From: Scott Marlowe @ 2008-04-22 15:16 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; +Cc: Bart Degryse <Bart.Degryse@indicator.be>; Craig Ringer <craig@postnewspapers.com.au>; pgsql-sql@postgresql.org, "Roland Voegtli" <voegtli@scnat.ch>
On Tue, Apr 22, 2008 at 7:00 AM, Nacef LABIDI <nacef.l@gmail.com> wrote:
> Thank you all for your useful comments.
>
> I have tried to order my records as you said and got it work as I wanted.
Cool beans! I was just watching this conversation, but wanted to
point out that using the methods mentioned in this thread (i.e. ones
that use order by) is good practice. It's quite possible that at some
point in the future the storage engine of MS-SQL could change and
break your application on that platform. By using the order by
method, you ensure you're using a method that works today and in the
future on all major platforms.
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 10:11 ` Thomas Kellerer <spam_eater@gmx.net>
2 siblings, 0 replies; 13+ messages in thread
From: Thomas Kellerer @ 2008-04-22 10:11 UTC (permalink / raw)
To: pgsql-sql
Nacef LABIDI, 22.04.2008 11:54:
> Hi all,
>
> I am using Postgres in a Delphi application through ODBC. I am having an
> issue with updating records.
>
> When I create a dataset to get the records in a table then after I
> update one of these records and then refresh the dataset, the record
> goes to the end of the dataset. This is disappointing when editing
> records on a DBGrid, where users find their updated records jump to the
> end of the grid. Even after restarting the application, the updated
> record keeps showing at the end of the grid. I have tried the same thing
> with SQL Server and it works normally, so I thought it was a postgres
> behvior.
>
> Has anyone an idea about what could be the cause of such a behavior.
Rows in a relational database are not sorted. This is true for any RDBMS.
If you want to apply a certain sort order you *have* to use an ORDER BY clause for your SELECT.
If the rows show up in the order you "expect" without an ORDER BY this is pure coincidence (even with SQL Server)
The simply solution is to add an ORDER BY that sorts e.g. by a timestamp that is set when the row is created.
Regards
Thomas
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: After updating dataset the record goes to the end of the dataset
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
@ 2008-04-22 10:12 ` Gurjeet Singh <singh.gurjeet@gmail.com>
2 siblings, 0 replies; 13+ messages in thread
From: Gurjeet Singh @ 2008-04-22 10:12 UTC (permalink / raw)
To: Nacef LABIDI <nacef.l@gmail.com>; +Cc: pgsql-sql
On Tue, Apr 22, 2008 at 3:24 PM, Nacef LABIDI <nacef.l@gmail.com> wrote:
> Hi all,
>
> I am using Postgres in a Delphi application through ODBC. I am having an
> issue with updating records.
>
> When I create a dataset to get the records in a table then after I update
> one of these records and then refresh the dataset, the record goes to the
> end of the dataset. This is disappointing when editing records on a DBGrid,
> where users find their updated records jump to the end of the grid. Even
> after restarting the application, the updated record keeps showing at the
> end of the grid. I have tried the same thing with SQL Server and it works
> normally, so I thought it was a postgres behvior.
>
> Has anyone an idea about what could be the cause of such a behavior.
>
The data is not guaranteed to be ordered if you do not specify an ORDER BY
clause in your query. Try adding a meaningful ORDER BY clause, that should
solve the problem.
HTH,
Best regards,
--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
EnterpriseDB http://www.enterprisedb.com
Mail sent from my BlackLaptop device
^ permalink raw reply [nested|flat] 13+ messages in thread
end of thread, other threads:[~2008-04-22 15:16 UTC | newest]
Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-22 09:54 After updating dataset the record goes to the end of the dataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:10 ` Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:15 ` hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 10:31 ` Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 10:45 ` Pavan Deolasee <pavan.deolasee@gmail.com>
2008-04-22 11:02 ` hubert depesz lubaczewski <depesz@depesz.com>
2008-04-22 11:02 ` Padam J Singh <padam.singh@inventum.cc>
2008-04-22 12:46 ` Craig Ringer <craig@postnewspapers.com.au>
2008-04-22 12:56 ` Re: After updating dataset the record goes to the end of thedataset Bart Degryse <Bart.Degryse@indicator.be>
2008-04-22 13:00 ` Re: After updating dataset the record goes to the end of thedataset Nacef LABIDI <nacef.l@gmail.com>
2008-04-22 15:16 ` Re: After updating dataset the record goes to the end of thedataset Scott Marlowe <scott.marlowe@gmail.com>
2008-04-22 10:11 ` Thomas Kellerer <spam_eater@gmx.net>
2008-04-22 10:12 ` Gurjeet Singh <singh.gurjeet@gmail.com>
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