next up previous contents index
Next: Using NULL Values Up: Customizing Queries Previous: Data Types

  
Quotes Inside Text

Suppose you want to insert the name O'Donnell. You might be tempted to enter it in psql as 'O'Donnell', but this approach will not work. The presence of a single quote inside a single-quoted string generates a parser error.  One way to place a single quote inside a single-quoted string is to use two quotes together--for example, 'O''Donnell'.9.2 Two single quotes inside a single-quoted string causes one single quote to be generated. Another option is to use a backslash--for example, 'O\'Donnell'. The backslash escapes the single quote character. 


Bruce Momjian
2001-05-09