String literals and also run away personalities in postgresql

Trying to insert a retreat personality right into a table causes a caution.

As an example:

create table EscapeTest (text varchar(50));

insert into EscapeTest (text) values ('This is the first part \n And this is the second');


Generates the caution:

WARNING:  nonstandard use of escape in a string literal


(Making use of PSQL 8.2)

Any person recognize just how to navigate this?

0
2019-05-03 22:33:05
Source Share

Cool.

I additionally located the documents pertaining to the E :

PostgreSQL additionally approves "retreat" string constants, which are an expansion to the SQL criterion. A retreat string constant is defined by creating the letter E (upper or lower instance ) prior to the opening solitary quote, e.g. E'foo'. (When proceeding a retreat string constant throughout lines, write E just prior to the first opening quote. ) Within a retreat string, a backslash personality (\ ) starts a C-like backslash retreat series, in which the mix of backslash and also adhering to personality (s ) stands for an unique byte value. \ b is a backspace, \ f is a kind feed, \ n is a newline, \ r is a carriage return, \ t is a tab. Additionally sustained are \ figures, where figures stands for an octal byte value, and also \ xhexdigits, where hexdigits stands for a hexadecimal byte value. (It is your duty that the byte series you create stand personalities in the web server personality set inscribing. ) Any kind of various other personality adhering to a backslash is taken essentially. Hence, to include a backslash personality, write 2 backslashes (\ \ ). Additionally, a solitary quote can be consisted of in a retreat string by creating ', along with the regular means of ".

0
2019-05-07 17:32:24
Source

Partially. The message is put, yet the caution is still created.

I located a conversation that showed the message required to be come before with 'E', thus :

insert into EscapeTest (text) values (E'This is the first part \n And this is the second');


This subdued the caution, yet the message was still not being returned appropriately. When I included the added lower as Michael recommended, it functioned.

Thus :

insert into EscapeTest (text) values (E'This is the first part \\n And this is the second');

0
2019-05-07 17:17:27
Source