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

Re: Escaping literal strings in pg_8.4

From: ennio <eiannucci(at)tin(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Escaping literal strings in pg_8.4
Date: 2012-04-18 22:16:54
Message-ID: 20120418221654.GA15025@deby.ei.hnet (view raw or flat)
Thread:
Lists: pgsql-novice
* Willy-Bas Loos <willybas(at)gmail(dot)com> [180412, 09:10]:
> well, you have one single quote before the first backslash. so that's the
> end of the quoted string. Then comes a backslash, which is bad syntax. So
> it's the quote, not the backslash that causes the error.
> 
> maybe you mean this:
> --
> Vediamo se quest''altro \r\n lo riconosce come un a capo \r\n e questo
> dovrebbe essere il nuovo rigo: ''bla bla bla''!
> --
> psql -c "insert into bibl_memos values(12000, E'`cat prova12000.memo`');"
> INSERT 0 1
> psql -c "select * from bibl_memos"
>   id   |                           val
> -------+---------------------------------------------------------
>  12000 | Vediamo se quest'altro \r                              +
>        |  lo riconosce come un a capo \r                        +
>        |  e questo dovrebbe essere il nuovo rigo: 'bla bla bla'!
> (1 row)
> 
> It is kind of hard to get text like that into insert statements.
> I would advise to use COPY. It takes TAB delimeted files, or CSV (e.g. from
> a spreadsheet)
> 
> HTH, cheers,
> 
> WBL
> 
Oh, I realize I was putting the 'E' in the wrong place:

> > 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''!

Your suggestion works perfectly!
Thank you Willy and best regards,
     ennio

-- 
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.    \\?//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]    (°|°)
 Ricevo solo messaggi Content-Type: plain/text (no html o multipart).   )=(
 !!! --> e-mail a mio nome via OE (M$) sono false  e infette <-- !!!

In response to

pgsql-novice by date

Next:From: Guillaume HenriotDate: 2012-04-19 14:18:58
Subject: Re: Returning generated id after a transaction.
Previous:From: Bartosz DmytrakDate: 2012-04-18 19:45:52
Subject: Re: Returning generated id after a transaction.

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