1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00
Files
til/postgres/escaping-a-quote-in-a-string.md
2016-01-27 22:06:09 -06:00

16 lines
437 B
Markdown

# Escaping A Quote In A String
In PostgreSQL, string (`varchar` and `text`) literals are declared with
single quotes (`'`). That means that any string containing a single quote
will need some escaping. The way to escape a single quote is with another
single quote.
```sql
> select 'what''s up!';
?column?
------------
what's up!
```
[source](http://jonathansacramento.com/posts/20160122-improve-postgresql-workflow-vim-dbext.html)