Skip site navigation (1) Skip section navigation (2)

Escaping literal strings in pg_8.4

From: Ennio-Sr <nasr(dot)laili(at)tin(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Escaping literal strings in pg_8.4
Date: 2012-04-12 17:45:08
Message-ID: 20120412174508.GA32586@deby.ei.hnet (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi all!

[using postgresql_8.4 under debian/GNU-Linux 2.6.32]

I'm trying to understand how the escape_string is supposed to work.
After writing a file ('prova12000.memo')  with this single line:
Vediamo se quest''altro E'\r\n' lo riconosce come un a capo E'\r\n' e questo dovrebbe essere il nuovo rigo: ''bla bla bla''!
entered the command:

$ psql mydb -c "insert into bibl_memos values(12000, '`cat prova12000.memo`');"

and got:

ERROR:  syntax error at or near "\"
LINE 1: ...bl_memos values(12000, 'Vediamo se quest''altro E'\r\n' lo r...
Both the lines 'escape_string_warning=on' and 'standard_conforming_strings=off' are commented out in postgresql.conf.

Could somebody please explain what is going wrong?

Thanks for your attention. Regards,
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]


pgsql-novice by date

Next:From: keshav dixitDate: 2012-04-13 10:48:52
Subject: Service start up error "The Service name is invalid net helpmsg 2185"
Previous:From: Bob McConnellDate: 2012-04-12 16:51:09
Subject: Switching python app from sqlite to postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group