don't understand something about backslashes

From: Dennis Gearon <gearond(at)cvc(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: don't understand something about backslashes
Date: 2003-03-20 19:38:50
Message-ID: 3E7A18CA.9050404@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a varchar that is 64 wide. I prescape stuff like the '-'
character to prevent SQL injection.

Here is the EXACT field value that I inserted recently,for a test. It
comes to approx 100 chars.

'\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1\-1'::varchar,

I insert that and get:

NO ERROR

When I look at the record in phpPgAdmin, the slashes don't show up in
the record.

So, do they make it to the record, anyone know? What do I have to do for
the PostgreSQL engine to prevent '--' character from ending a line in a
a string? Or in general, get the backslashes in the record?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2003-03-20 19:39:41 Re: log_timestamp and SIGHUP?
Previous Message jwsacksteder 2003-03-20 19:28:22 temporary table oddity