char - Insert line break in postgresql when updating text field -



char - Insert line break in postgresql when updating text field -

i trying update text field in table of postgresql database.

update public.table set long_text = 'first line' + char(10) + 'second line.' id = 19;

my intended result cell this:

first line sec line

the above syntax returns error.

you want chr(10) instead of char(10).

be careful this, because might wrong newline. "right" newline depends on client consumes it. macs, windows, , linux utilize different newlines. browser expect <br />.

it might safest write update postgresql 9.1+. read docs linked below.

update public.table set long_text = e'first line\nsecond line.' id = 19;

the default value of 'standard_conforming_strings' 'on' in 9.1+.

show standard_conforming_strings;

postgresql char sql-update

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -