Re: [SQL] the use of $$string$$

2011-11-08 Thread Jasen Betts
On 2011-11-07, Richard Huxton wrote: > On 05/11/11 00:12, John Fabiani wrote: > OK, so it seems psycopg is quoting your strings for you (as you'd > expect). It's presumably turning your query into: > ... values (E'123', $$E''$$) > So - the $$ quoting is unnecessary here - just use the % pla

Re: [SQL] the use of $$string$$

2011-11-07 Thread Peter Eisentraut
On mån, 2011-11-07 at 08:44 +, Richard Huxton wrote: > > myvarString = "long string that contains single quotes" > > cusor.execute("insert into table (pkid, myfield) values (%s, $$%s > $$)",(123, > > myvarString)) > > > > When I execute the above I'm seeing: > > E'long string that contains sing

Re: [SQL] the use of $$string$$

2011-11-07 Thread Richard Huxton
On 05/11/11 00:12, John Fabiani wrote: I'm using psycopg2. OK - bear in mind, I'm not a Python user. This is what I'm doing from python myvarString = "long string that contains single quotes" cusor.execute("insert into table (pkid, myfield) values (%s, $$%s$$)",(123, myvarString)) When I exe

Re: [SQL] the use of $$string$$

2011-11-05 Thread John Fabiani
On Friday, November 04, 2011 11:06:37 am Richard Huxton wrote: > On 04/11/11 15:26, John Fabiani wrote: > > On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: > >> Hi, > >> I just discovered that I can use $$string$$ to account for the problem > >> of single quotes in the string (or other

Re: [SQL] the use of $$string$$

2011-11-04 Thread Richard Huxton
On 04/11/11 15:26, John Fabiani wrote: On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the table field contained E'string'.

Re: [SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
On Friday, November 04, 2011 09:05:19 am David Johnston wrote: > On Nov 4, 2011, at 11:26, John Fabiani wrote: > > On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: > >> Hi, > >> I just discovered that I can use $$string$$ to account for the problem > >> of single quotes in the string (

Re: [SQL] the use of $$string$$

2011-11-04 Thread David Johnston
On Nov 4, 2011, at 11:26, John Fabiani wrote: > On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: >> Hi, >> I just discovered that I can use $$string$$ to account for the problem of >> single quotes in the string (or other strange char's). However, I noticed >> that the table field co

Re: [SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: > Hi, > I just discovered that I can use $$string$$ to account for the problem of > single quotes in the string (or other strange char's). However, I noticed > that the table field contained E'string'. I actually tried to find info on >

Re: [SQL] the use of $$string$$

2011-11-04 Thread Tom Lane
John Fabiani writes: > I just discovered that I can use $$string$$ to account for the problem of > single quotes in the string (or other strange char's). However, I noticed > that the table field contained E'string'. I actually tried to find info on > this but I did not find anything. > Co

Re: [SQL] the use of $$string$$

2011-11-04 Thread bricklen
On Fri, Nov 4, 2011 at 7:38 AM, John Fabiani wrote: > Hi, > I just discovered that I can use $$string$$ to account for the problem of > single quotes in the string (or other strange char's).  However, I noticed > that the table field contained E'string'.  I actually tried to find info on > this bu

[SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the table field contained E'string'. I actually tried to find info on this but I did not find anything. Could someone explain what it