Through pgAdmin 4 there is a table of posts. Accordingly, the content of the post is recorded in one of the columns. When extracting and displaying an element on a page, all translations to a new line are ignored and all individual items are glued together into one continuous unreadable text. How can this be corrected so that the footnotes are not lost? Is there a special syntax for postgres line breaks?

  • one
    I think, the text of the posts you have is edited in the usual textarea, so with this in the output, replace the line break with the <br> tag. - nörbörnën pm
  • Solved the problem a little differently, but thanks to your tip using the tag. The text of the post in the database, I was stored in a variable of type text, and I added there in the right places <br>. For the page rendering, I use express-handlebars, so that when passing the content variable with my text to the page, the tags are not output, but processed, I had to wrap the content in three curly braces instead of two. In general, somehow it finally worked. Thank you very much for your help! - username

1 answer 1

This can be done using the escape sequence:

 SELECT STRING_AGG(t.param, E'\n') params ... 

Grouped columns will be glued together with a line break.

See here for details: https://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html (p. 4.1.2.2. String Constants with C-style Escapes).