|
132 | 132 | is required for those wishing to migrate data from any
|
133 | 133 | previous release of <productname>Postgres</productname>.
|
134 | 134 | </para>
|
135 |
| - </sect2> |
| 135 | + |
| 136 | + <para> |
| 137 | + |
| 138 | + Because readers in 6.5 don't lock data, regardless of transaction |
| 139 | + isolation level, data read by one transaction can be overwritten by |
| 140 | + another. In the other words, if a row is returned by |
| 141 | + <command>SELECT</command> it doesn't mean that this row really exists |
| 142 | + at the time it is returned (i.e. sometime after the statement or |
| 143 | + transaction began) nor that the row is protected from deletion or |
| 144 | + updation by concurrent transactions before the current transaction does |
| 145 | + a commit or rollback. |
| 146 | + |
| 147 | + </para> |
| 148 | + |
| 149 | + <para> |
| 150 | + |
| 151 | + To ensure the actual existance of a row and protect it against |
| 152 | + concurrent updates one must use <command>SELECT FOR UPDATE</command> or |
| 153 | + an appropriate <command>LOCK TABLE</command> statement. This should be |
| 154 | + taken into account when porting applications from previous releases of |
| 155 | + <productname>Postgres</productname> and other environments. |
| 156 | + |
| 157 | + </para> |
| 158 | + |
| 159 | + <para> |
| 160 | + |
| 161 | + Keep above in mind if you are using contrib/refint.* triggers for |
| 162 | + referential integrity. Additional technics are required now. One way is |
| 163 | + to use <command>LOCK parent_table IN SHARE ROW EXCLUSIVE MODE</command> |
| 164 | + command if a transaction is going to update/delete a primary key and |
| 165 | + use <command>LOCK parent_table IN SHARE MODE</command> command if a |
| 166 | + transaction is going to update/insert a foreign key. |
| 167 | + |
| 168 | + <note> |
| 169 | + <para> |
| 170 | + |
| 171 | + Note that if you run a transaction in SERIALIZABLE mode then you must |
| 172 | + execute <command>LOCK</command> commands above before execution of any |
| 173 | + DML statement |
| 174 | + (<command>SELECT/INSERT/DELETE/UPDATE/FETCH/COPY_TO</command>) in the |
| 175 | + transaction. |
| 176 | + |
| 177 | + </para> |
| 178 | + </note> |
| 179 | + |
| 180 | + <para> |
| 181 | + |
| 182 | + These inconveniences will disappear when the ability to read durty |
| 183 | + (uncommitted) data, regardless of isolation level, and true referential |
| 184 | + integrity will be implemented. |
| 185 | + |
| 186 | + </para> |
| 187 | + |
| 188 | + </para> |
| 189 | + |
| 190 | + </sect2> |
136 | 191 |
|
137 | 192 | <sect2>
|
138 | 193 | <title>Detailed Change List</title>
|
139 |
| - |
140 | 194 | <para>
|
141 | 195 | <programlisting>
|
142 | 196 | Bug Fixes
|
|
0 commit comments