Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

An

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

2 Answers 2

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

 
discard

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.