1

Just had to import some data in my postgreSQL db with sometimes single quote escapes. Everything is fine, but at the end I still have my '' escapes in my DB values.

before import : L'Auberge D'Aillane

after import (when I do a "SELECT name from mytable") : L''Auberge D''Aillane

is that normal ? is there any way to have to right value in the entries ?

thanks a lot

Alex Pereira
  • 916
  • 1
  • 9
  • 17

2 Answers2

0

You can find a detailed answer here: Insert text with single quotes in PostgreSQL

But as quick response use the backslash escape instead of double quotes: In old versions or if you still run with standard_conforming_strings = off or, generally, if you prepend your string with E to declare Posix escape string syntax, you can also escape with the backslash :

E'user\'s log'
Community
  • 1
  • 1
  • i'm in psql 9.4.5 so double quotes escaping should be running well, no ? i don't want to user E escape as it's not supported no and standard_conforming_strings should be on. – Alex Pereira May 16 '16 at 11:12
0

As you logged your question here also: https://github.com/brianc/node-postgres/issues/1020

The answer is the very same:

as you see I use the double-quote escape to avoid any insertion error

You shouldn't be doing that ever! The node-postgres library's internal formatting provides the correct escaping for strings as well as all the other JavaScript types.

vitaly-t
  • 24,279
  • 15
  • 116
  • 138