I wanted to store the formatted text in the database. Sort of

Сущность1: потомок1: свойство1 потомок2: свойство2 Сущность2: потомок1: свойство1 потомок2: свойство2 

It seems like the field is xml. But I think the format is "fat". Or jsonp for such purposes use?

Search by text is not planned. Just want to edit and display formatted text on the web.

My thoughts

  1. if you reduce the task to a two-dimensional array, then json

    INSERT INTO testdb.test (txt_json) VALUES ('{"name": "Administrator", "login": "root", "databases": "lol"}' :: json), ('{{"name": " Administrator2 "," login ":" root2 "," databases ":" lol2 "} ':: json)

and then

 SELECT json_each_text ( txt_json ) FROM testdb.test 

The only thing is that the lines (username, Administrator) will have to be parsed by the first comma.

  1. You can use which thread RichText Editor

Pros - any kind. Cons - implementation difficulty

  1. Do not try to store a field — as I did — a field — a link to a wiki description page. That is, storage and formatting are given to another system.
  • one
    And what a simple type field like the text does not suit? - Petr Abdulin
  • how? formatting html save? just looking at yaml and thinking how to implement its similarity - des1roer
  • one
    From your question is not clear the essence of the problem. Any printed characters in the usual text box saves perfectly. - Petr Abdulin
  • If you want to do the most correct, then I suggest using a document-oriented DBMS, for example, mongodb . - MichaelPak
  • so why should she tell me? I think json is enough for the eyes - des1roer

1 answer 1

Postgresql perfectly knows how to work with json, so I recommend using it.

  • and with json and c jsonb and c xml. I don’t see a simple way. will have to answer anyway parse and process. and the update request is not clear how to form. - des1roer
  • Explain that you are going to parse? - Mstislav Pavlov