Re: I have a select statement on the issue.

From: Thomas Pundt <mlists(at)rp-online(dot)de>
To: pgsql-general(at)postgresql(dot)org, gongzhixiao(at)gmail(dot)com
Subject: Re: I have a select statement on the issue.
Date: 2007-11-28 08:31:49
Message-ID: 200711280931.49677.mlists@rp-online.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On Mittwoch, 28. November 2007, gongzhixiao(at)gmail(dot)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(dot)pundt(at)rp-online(dot)de> ---- http://rp-online.de/ ----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2007-11-28 08:51:54 Re: Linux v.s. Mac OS-X Performance
Previous Message Rodrigo De León 2007-11-28 08:26:53 Re: I have a select statement on the issue.