Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm trying to put some Latex code in a PostgreSQL Database. Created a table with cid as Serial type and code_text as text type. After an INSERT Statement

INSERT INTO texcode (code_text) VALUES ('\document example');

i get an warning about false escape breaks within the Statement.


SELECT code_text from texcode;

returns me

"document example"

How can i fix this behavior? (i use an ruby script to Import my old tex files, so this above example is only to demonstrate.)

share|improve this question
up vote 1 down vote accepted

You need to escape the backslash by writing two backslashes, like this:

INSERT INTO texcode (code_text) VALUES ('\\document example');
share|improve this answer
this on worked like a charm. Thanks – patricks Feb 28 '13 at 12:51

As it was said befoer you can escape the string with doble slashes (\), if you get a warning you can avoid it using the E string, like E'\document example'

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.