On 5/29/06, John Siracusa <[EMAIL PROTECTED]> wrote:
On 5/29/06 1:54 PM, Cees Hek wrote: > I think I have found a bug in the chkpass support for Pg in > Rose::DB::Object. If you load an existing row from the database, then > make a change to a column (not the password column), and then save the > changes, the password field will be blanked out.Are you sure the database side is set up correctly? Can you show me your table definition? I have tests for this in the RDBO test suite and they pass for me. I just added two more tests to confirm, and they work as well.
Hi John, I have attached a script that demonstrates the problem (at least what I am seeing). To trigger the problem, you need to load a record from the DB, change something besides the chkpass field, save the changes, throw away that object, and reload a fresh object from the DB. Here are the results that I get from running the test script (this is with debugging turned on to show what the update statements are doing): INSERT INTO rose_test_users ( id, login, password ) VALUES ( ?, ?, ? ) - bind params: 1, test, 123 New User just created password: 123 password_encrypted: :qCBhFg1k5t6IA UPDATE rose_test_users SET login = ?, password = ? WHERE id = ? - bind params: test2, 123, 1 New User after first save password: 123 password_encrypted: :qCBhFg1k5t6IA SELECT id, login, password FROM rose_test_users WHERE login = ? - bind params: test2 Reloading User from DB password: password_encrypted: :N3C3orSE7snBg UPDATE rose_test_users SET login = ?, password = ? WHERE id = ? - bind params: test, , 1 Reloaded User after change to login and save password: password_encrypted: :N3C3orSE7snBg SELECT id, login, password FROM rose_test_users WHERE login = ? - bind params: test Reload User from DB again password: password_encrypted: So as you can see, the second update sets password to '', and on a fresh reload, you can see that the password field is now blank. Once again, these are the particulars: PostgreSQL - 7.4.9 (debian package) perl - 5.8.8 (debian package) DBD::Pg - 1.49 Rose::DB - 0.673 Rose::DB::Object - 0.727 Cheers, Cees
rose_pg_crypt_test.pl
Description: Perl program