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

using cont on Oracle CLOB column is converting value to empty_clob() #1476

Open
dsusco opened this issue Jan 11, 2024 · 0 comments
Open

using cont on Oracle CLOB column is converting value to empty_clob() #1476

dsusco opened this issue Jan 11, 2024 · 0 comments

Comments

@dsusco
Copy link

dsusco commented Jan 11, 2024

I have the following table:

CREATE TABLE "NOTIFICATIONS" ("ID" NUMBER(38) NOT NULL PRIMARY KEY, "NOTIFICATION_TYPE" VARCHAR2(255) NOT NULL, "NAME" VARCHAR2(255) NOT NULL, "MESSAGE" CLOB NOT NULL, "CREATED_AT" TIMESTAMP(6) NOT NULL, "UPDATED_AT" TIMESTAMP(6) NOT NULL);

And the following parameters:

Parameters: {"per"=>"10", "q"=>{"s"=>["id asc"], "notification_type_eq"=>"", "name_cont"=>"", "message_cont"=>"A"}}

Generate this query in Oracle:

SELECT "NOTIFICATIONS".* FROM "NOTIFICATIONS" WHERE "NOTIFICATIONS"."MESSAGE" LIKE empty_clob() ORDER BY "NOTIFICATIONS"."ID" ASC OFFSET :a1 ROWS FETCH FIRST :a2 ROWS ONLY  [["OFFSET", 0], ["LIMIT", 10]]

However, when I add this simple ransacker:

ransacker :message do |parent|
  Arel.sql(%Q["NOTIFICATIONS"."MESSAGE"])
end

There's no issue and I get the following query:

SELECT "NOTIFICATIONS".* FROM "NOTIFICATIONS" WHERE "NOTIFICATIONS"."MESSAGE" LIKE '%A%' ORDER BY "NOTIFICATIONS"."ID" ASC OFFSET :a1 ROWS FETCH FIRST :a2 ROWS ONLY  [["OFFSET", 0], ["LIMIT", 10]]

Does anyone have any idea why this is happening/necessary?

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