Re: the use of $$string$$

From: John Fabiani <johnf(at)jfcomputer(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: the use of $$string$$
Date: 2011-11-04 16:33:07
Message-ID: 201111040933.07075.johnf@jfcomputer.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Friday, November 04, 2011 09:05:19 am David Johnston wrote:
> On Nov 4, 2011, at 11:26, John Fabiani <johnf(at)jfcomputer(dot)com> 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'. I actually tried to
> >> find info on this but I did not find anything.
> >>
> >> Could someone explain what it means or better provide a web link for me
> >> to discover the info.
> >>
> >> Thanks in advance,
> >> Johnf
> >
> > Thank you both for the quick replies and the links.
> >
> > What I still do not understand (I'm a little slow) is the fact that
> > pgadmin3 showed the data as E'string'. So I'm wondering if the data is
> > now different in the sense that I need use the 'E' in the field.
> >
> > For example I have the last name of O'Reilly
> > the field lname now appears to contain E'O'Reilly'
> >
> > So will the normal select statements work;
> >
> > Select * from table where lname = 'O'' Reilly'
> > Select * from table where lname like 'O%'
> >
> > or will I need to know the data contains the "E" and add the 'E' to the
> > sql statements?
> >
> > Thanks
> > Johnf
>
> Try it and see.
>
> If, indeed, the E is part of the data you should fix your process. Done
> correctly there should be no difference in the end result regardless of
> how you choose to identify your strings.
>
> Don't use pgadmin3 myself so I don't know if what you are looking at would
> include the E. If it is outputting DDL (I.e., INSERT statements) it might
> but simple SELECT results should not.
>
> David J.

I am testing - but I lack the data to do so. When I discovered the 'E' I
quickly decided against using the $$ to insert data. But I did use it with
one field and when I do a select from python I do get the 'E' on the only
field I have. That was disappointing.

I was hoping to short cut the testing and get good advise from the group.

I really need to look into this much further but I also have to get the job
done.

Johnf

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2011-11-04 18:06:37 Re: the use of $$string$$
Previous Message David Johnston 2011-11-04 16:05:19 Re: the use of $$string$$