Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#write_lobs called only on update but not on create #2226

Open
akostadinov opened this issue Dec 7, 2021 · 1 comment
Open

#write_lobs called only on update but not on create #2226

akostadinov opened this issue Dec 7, 2021 · 1 comment

Comments

@akostadinov
Copy link
Contributor

I'm not exactly sure whether this is an issue or expected behavior. I didn't observe any error and I'm not an experienced Oracle dba. It just looks strange.

Steps to reproduce

run test should serialize LOBs when creating a record from #2203

Expected behavior

#write_lobs is called

  TestEmployee Create (77.7ms)  INSERT INTO "TEST_EMPLOYEES" ("FIRST_NAME", "LAST_NAME", "SIGNATURE", "ID") VALUES (:a1, :a2, :a3, :a4)  [["first_name", "Peter"], ["last_name", "Doe"], ["signature", "cGV0ZXInc3NpZ25hdHVyZQ==\n"], ["id", 1]]
  Writable Large Object (2.4ms)  SELECT "SIGNATURE" FROM "TEST_EMPLOYEES" WHERE "ID" = 1 FOR UPDATE

Actual behavior

#write_lobs is not called

  TestEmployee Create (77.7ms)  INSERT INTO "TEST_EMPLOYEES" ("FIRST_NAME", "LAST_NAME", "SIGNATURE", "ID") VALUES (:a1, :a2, :a3, :a4)  [["first_name", "Peter"], ["last_name", "Doe"], ["signature", "cGV0ZXInc3NpZ25hdHVyZQ==\n"], ["id", 1]]

System configuration

Rails version:
Same as test code in master.

Oracle enhanced adapter version:
Master branch.

Ruby version:
2.7.3p183

Oracle Database version:
19.3.0

@akostadinov
Copy link
Contributor Author

I see that the write_lob hooks are only registered on UPDATE. Is there any special reason for that? What is the reason not to be registered on SAVE as well?

https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced/lob.rb#L14-L15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant