How can I force a single quote (') or % character in my SQL LIKE query?

Here’s what I got from Bubble support:

Short Answer: use this format: ‘%’ || $1 || ‘%’

Long answer:

We use Postgres’ query-escaping mechanism to safely send parameters to queries to avoid SQL injection attacks. So, we don’t actually replace the $1 on Bubble’s end. We use Postgres’s PREPARE statement (https://www.postgresql.org/docs/9.6/static/sql-prepare.html) to build a query with a placeholder, then send the value separately.

What this means is that you can only use $ values in places where postgres allows them. You can’t embed them in the middle of a string. Instead, you can use string concatenation to accomplish what you want to do here:

where keywords like ‘%’ || $1 || ‘%’

The || operator combines two strings into a longer one; more information here: https://www.postgresql.org/docs/9.6/static/functions-string.html