Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.2.0
-
None
Description
For example, let's say a table which has null-able columns. When rows get deleted, CaptureChangeMySQL emits 'delete' events for each deleted row with all column values including null-able ones. From those data, PutDatabaseRecord can generate delete statements for other table which have where clause like this:
DELETE FROM users WHERE id = 4 AND title = null AND first = 'Koji' AND last = 'Kawamura' AND street = null AND city = null AND state = null AND zip = null AND gender = null AND email = null AND username = null AND password = null AND phone = null AND cell = null AND ssn = null AND date_of_birth = null AND reg_date = null AND large = null AND medium = null AND thumbnail = null AND version = null AND nationality = null
However, a condition like 'title = null' doesn't hit with any record, because for null value, we should use 'title IS null' instead.
I think we should do something like below in order to treat these null-able columns:
# With a prepared statement like this: DELETE FROM users WHERE id = ? AND (title = ? OR (title is null AND ? is null)) AND ... so on ...; # Which is executed like this: DELETE FROM users WHERE id = 4 AND (title = null OR (title is null AND null is null)) … and so on …;
Reference:
http://stackoverflow.com/questions/4215135/how-to-deal-with-maybe-null-values-in-a-preparedstatement
Attachments
Issue Links
- causes
-
NIFI-8530 PutDatabaseRecord DELETE issue with Postgres UUID
- Resolved
- links to