Insert text with single quotes in PostgreSQL

后端 未结 7 2148
北海茫月
北海茫月 2020-11-21 11:28

I have a table test(id,name).

I need to insert values like: user\'s log, \'my user\', customer\'s.



        
7条回答
  •  感情败类
    2020-11-21 11:53

    According to PostgreSQL documentation (4.1.2.1. String Constants):

     To include a single-quote character within a string constant, write two 
     adjacent single quotes, e.g. 'Dianne''s horse'.
    

    See also the standard_conforming_strings parameter, which controls whether escaping with backslashes works.

提交回复
热议问题