Re: 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: Re: Escaping literal strings in pg_8.4
Date: 2012-04-19 14:45:35
Message-ID: 20120419144535.GA30181@deby.ei.hnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Willy-Bas Loos 2012-04-19 16:32:27 Re: Escaping literal strings in pg_8.4
Previous Message Guillaume Henriot 2012-04-19 14:18:58 Re: Returning generated id after a transaction.