# Extra Characters in Find?

**URL:** <https://www.ruby-forum.com/t/extra-characters-in-find/153590>\
**Category:** Rails\
**Created:** [November 19, 2008, 4:45am UTC](https://www.ruby-forum.com/t/extra-characters-in-find/153590 "2008-11-19T04:45:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [November 19, 2008, 4:45am UTC](https://www.ruby-forum.com/t/extra-characters-in-find/153590/1 "2008-11-19T04:45:38Z")

</div>

Hi-

I’m trying to submit a query through active record, and when I watch  
the development log to see what is getting passed in, I see something  
like this:

SELECT \* FROM “my\_model” WHERE (some\_name LIKE E’%search%’)

Is the “E” character supposed to be there? I am not getting results  
returned and I don’t know where that is coming from. Any ideas?

Thanks!

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [November 19, 2008, 4:51am UTC](https://www.ruby-forum.com/t/extra-characters-in-find/153590/2 "2008-11-19T04:51:29Z")

</div>

> I’m trying to submit a query through active record, and when I watch  
> the development log to see what is getting passed in, I see something  
> like this:
> 
> SELECT \* FROM “my\_model” WHERE (some\_name LIKE E’%search%')
> 
> Is the “E” character supposed to be there? I am not getting results  
> returned and I don’t know where that is coming from. Any ideas?

Are you using PostgreSQL? If so…

> **[4.1. Lexical Structure](https://www.postgresql.org/docs/current/sql-syntax-lexical.html)**
>
> 4.1. Lexical Structure 4.1.1. Identifiers and Key Words 4.1.2. Constants 4.1.3. Operators 4.1.4. Special Characters 4.1.5. Comments 4.1.6. Operator Precedence SQL …

PostgreSQL also accepts “escape” string constants, which are an  
extension to the SQL standard. An escape string constant is specified  
by writing the letter E (upper or lower case) just before the opening  
single quote, e.g. E’foo’. (When continuing an escape string constant  
across lines, write E only before the first opening quote.) Within an  
escape string, a backslash character () begins a C-like backslash  
escape sequence, in which the combination of backslash and following  
character(s) represents a special byte value. \b is a backspace, \f is  
a form feed, \n is a newline, \r is a carriage return, \t is a tab.  
Also supported are \digits, where digits represents an octal byte  
value, and \xhexdigits, where hexdigits represents a hexadecimal byte  
value. (It is your responsibility that the byte sequences you create  
are valid characters in the server character set encoding.) Any other  
character following a backslash is taken literally. Thus, to include a  
backslash character, write two backslashes (\). Also, a single quote  
can be included in an escape string by writing ', in addition to the  
normal way of ‘’.
