Re: Escaping literal strings in pg_8.4 - Mailing list pgsql-novice

From Ennio-Sr
Subject Re: Escaping literal strings in pg_8.4
Date
Msg-id 20120419144535.GA30181@deby.ei.hnet
Whole thread Raw
In response to Re: Escaping literal strings in pg_8.4  (Willy-Bas Loos <willybas@gmail.com>)
Responses Re: Escaping literal strings in pg_8.4  (Willy-Bas Loos <willybas@gmail.com>)
List pgsql-novice
* Willy-Bas Loos <willybas@gmail.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 <-- !!!


pgsql-novice by date:

Previous
From: Guillaume Henriot
Date:
Subject: Re: Returning generated id after a transaction.
Next
From: Willy-Bas Loos
Date:
Subject: Re: Escaping literal strings in pg_8.4