Thread: Non-standard escape sequences from Crystal Reports

Non-standard escape sequences from Crystal Reports

From
"Rob Richardson"
Date:
When our customer runs Crystal Reports reports created in an old version of CR and edited with CR XI, he gets a large number of warnings in his Postgres log files that look like this:
 
2010-10-05 11:28:00 EDTWARNING:  nonstandard use of \\ in a string literal at character 159
2010-10-05 11:28:00 EDTHINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
I just ran a test in which I connected to a different database server for which my log settings showed the statements that generated warnings.  The statement was this:
 
2010-10-05 11:28:00 EDTSTATEMENT:  select relname, nspname, relkind from pg_catalog.pg_class c, pg_catalog.pg_namespace n where relkind in ('r', 'v') and nspname like 'public' and relname like 'coil\\_status' and nspname not in ('pg_catalog', 'information_schema', 'pg_toast', 'pg_temp_1') and n.oid = relnamespace order by nspname, relname
Coil_status is the name of one of the two relations used in the report. 
 
Apparently, at some time in the distant past, it was necessary to do something special for underscore characters.  The two backslashes are apparently being ignored, because the report operates correctly. 
 
I tried running the same report on my computer, I did not get any warnings.  Our customer and my computer are both running Postgres 8.4.  I tried copying the customer's postgres.conf file onto my system and restarting my Postgres service, and I still got no warnings. 
 
Can anyone tell me if there is some setting that will stop these warnings from showing up (other than turning off warning messages completely, which I am about to suggest that the customer do)?  Also, does anyone know why my computer is not showing warnings while our customer's system is?
 
Thanks very much!
 
RobR
 

Re: Non-standard escape sequences from Crystal Reports

From
Rajesh Kumar Mallah
Date:
Dear Rob ,

this will give warning:
SELECT co_name from foo  where co_name ilike '%\\_%' limit 10;

and this will not:
SELECT co_name from foo  where co_name ilike E'%\\_%' limit 10;

regds
Rajesh Kumar Mallah.

Re: Non-standard escape sequences from Crystal Reports

From
Rajesh Kumar Mallah
Date:
Dear Rob,
Please do not go offlist.

Its not a matter of cancelling,
consider  the fragment  --> relname like 'coil\\_status'
the underscore has to be escaped because if its not done
'_' will match any *single* character (rule of ilike matching) ,
 its escaped so that it matches  '_' in strings.
 two backslash is required so that ilike gets \_
it is the rule of quoting literal values in sql.

if you can add E you can get rid of the warnings.

Regds
Rajesh Kumar Mallah.

On Tue, Oct 5, 2010 at 2:18 PM, Rob Richardson
<Rob.Richardson@rad-con.com> wrote:
> Thank you very much!  Your examples worked as you said they would work, and
> they showed that my database is logging those warnings when they happen.
> That indicates that the difference is in the Crystal Reports installation
> someplace.
>
> I don't understand how the backslashes are handled.  I added underscores to
> a couple of records in my coilstatus table, so one had "Fr_ee" and another
> had "Pack_ed".  Then, the query "SELECT status from coilstatus  where status
> like '%\\_%' limit 10;" gave me the warning that you predicted, and it found
> the two records with underscored statuses.  That tells me that the two
> backslashes cancelled each other out, and the query was the same as "SELECT
> status from coilstatus  where status like '%_%' limit 10;".  Why is that?
> Do I need to read about regular expressions?
>
> RobR
>
>

Re: Non-standard escape sequences from Crystal Reports

From
bricklen
Date:
> Can anyone tell me if there is some setting that will stop these warnings
> from showing up (other than turning off warning messages completely, which I
> am about to suggest that the customer do)?  Also, does anyone know why my
> computer is not showing warnings while our customer's system is?
>
> Thanks very much!
>
> RobR

Set "escape_string_warning = off" in your postgresql.conf file.

http://www.postgresql.org/docs/8.4/interactive/runtime-config-compatible.html