Re: don't understand something about backslashes

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: don't understand something about backslashes
Date: 2003-03-20 19:56:57
Message-ID: 20030320115548.D73004-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 20 Mar 2003, Dennis Gearon wrote:

> 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.

The backslashes are escaping what follows. If you want two backslashes
you need to double them probably.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-03-20 20:06:10 Re: don't understand something about backslashes
Previous Message Andrew Sullivan 2003-03-20 19:39:41 Re: log_timestamp and SIGHUP?