Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -747,10 +747,16 @@ |
748 | 748 | $keys = array_keys( $args ); |
749 | 749 | } |
750 | 750 | |
751 | | - $ignore = in_array( 'IGNORE', $options ) ? 1 : 0; |
752 | | - if ( $ignore ) |
| 751 | + $ignore = in_array( 'IGNORE', $options ) ? 'mw' : ''; |
| 752 | + if ( $ignore ) { |
| 753 | + $didbegin = 0; |
| 754 | + if (! $this->mTrxLevel) { |
| 755 | + $this->begin(); |
| 756 | + $didbegin = 1; |
| 757 | + } |
| 758 | + pg_query($this->mConn, "SAVEPOINT $ignore"); |
753 | 759 | $olde = error_reporting( 0 ); |
754 | | - |
| 760 | + } |
755 | 761 | $sql = "INSERT INTO $table (" . implode( ',', $keys ) . ') VALUES '; |
756 | 762 | |
757 | 763 | if ( $multi ) { |
— | — | @@ -785,6 +791,17 @@ |
786 | 792 | |
787 | 793 | if ( $ignore ) { |
788 | 794 | $olde = error_reporting( $olde ); |
| 795 | + $bar = pg_last_error(); |
| 796 | + if ($bar !== FALSE) { |
| 797 | + pg_query( $this->mConn, "ROLLBACK TO $ignore" ); |
| 798 | + } |
| 799 | + else { |
| 800 | + pg_query( $this->mConn, "RELEASE $ignore" ); |
| 801 | + } |
| 802 | + if ($didbegin) { |
| 803 | + $this->commit(); |
| 804 | + } |
| 805 | + ## IGNORE always returns true |
789 | 806 | return true; |
790 | 807 | } |
791 | 808 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -412,6 +412,7 @@ |
413 | 413 | generates a log entry. |
414 | 414 | * (bug 14088) Excessively long block expiry times are rejected as invalid, |
415 | 415 | keeps the log page from being distorted. |
| 416 | +* (bug 14708) Emulate INSERT...IGNORE with standard SQL for Postgres backend. |
416 | 417 | |
417 | 418 | === API changes in 1.13 === |
418 | 419 | |