Re: I have a select statement on the issue.

Поиск
Список
Период
Сортировка
От Thomas Pundt
Тема Re: I have a select statement on the issue.
Дата
Msg-id 200711280931.49677.mlists@rp-online.de
обсуждение исходный текст
Ответ на I have a select statement on the issue.  (gongzhixiao@gmail.com)
Список 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 по дате отправления:

Предыдущее
От: "Rodrigo De León"
Дата:
Сообщение: Re: I have a select statement on the issue.
Следующее
От: Greg Smith
Дата:
Сообщение: Re: Linux v.s. Mac OS-X Performance