PostgreSQL
 SQL >> Base de Dados >  >> RDS >> PostgreSQL

Literais de string e caracteres de escape no PostgreSQL

Para habilitar sintaxe de escape, use o prefixo E:

INSERT INTO EscapeTest (text)
VALUES (E'This is the first part \n And this is the second');

Se ainda houver problema, duplique a barra invertida:

INSERT INTO EscapeTest (text)
VALUES (E'This is the first part \\n And this is the second');

O prefixo E ativa escapes, e a barra dupla produz a sequência literal desejada.