Re: I have a select statement on the issue. - Mailing list pgsql-general

From Thomas Pundt
Subject Re: I have a select statement on the issue.
Date
Msg-id 200711280931.49677.mlists@rp-online.de
Whole thread Raw
In response to I have a select statement on the issue.  (gongzhixiao@gmail.com)
List pgsql-general
Hi,

On Mittwoch, 28. November 2007, gongzhixiao@gmail.com wrote:
| Step 4:Update Date
| update test set name='1111name' where code='1002'

Simplified, when you perform an update, PostgreSQL internally marks
the affected row as deleted and inserts a new row in the table. For details
look at the MVCC documentation, eg.

  http://www.postgresql.org/docs/8.2/interactive/mvcc-intro.html

| Results:
| code name     qty
| 1001 1001name  1
| 1003 1003name  3
| 1002 1111name  2
|
| Question:
| 1. Why the default output changes after I execute the update statement?

See above; output order is not guaranteed without order clause.

| 2. Qustion, sorting as main keys when query, how to do?

You mean: select * from test order by code ?


Ciao,
Thomas

--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----

pgsql-general by date:

Previous
From: "Rodrigo De León"
Date:
Subject: Re: I have a select statement on the issue.
Next
From: Greg Smith
Date:
Subject: Re: Linux v.s. Mac OS-X Performance