pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Does Postgres replace \\ with \ in an update query
2+ messages / 2 participants
[nested] [flat]

* Does Postgres replace \\ with \ in an update query
@ 2002-11-15 07:23 Vaughn Cleminson <vaughn@the-i-junction.com.removethis>
  2002-11-15 18:48 ` Re: Does Postgres replace \\ with \ in an update query Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Vaughn Cleminson @ 2002-11-15 07:23 UTC (permalink / raw)
  To: pgsql-sql

Hi All

I am doing a normal SQL update against postgres.
Seems to be replacing \\ with \ when it gets saved in the database. eg.
\\machine\folder is being replaced with \machine

Any ideas?

Vaughn





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Does Postgres replace \\ with \ in an update query
  2002-11-15 07:23 Does Postgres replace \\ with \ in an update query Vaughn Cleminson <vaughn@the-i-junction.com.removethis>
@ 2002-11-15 18:48 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2002-11-15 18:48 UTC (permalink / raw)
  To: Vaughn Cleminson <vaughn@the-i-junction.com.removethis>; pgsql-sql

On Friday 15 Nov 2002 7:23 am, Vaughn Cleminson wrote:
> Hi All
>
> I am doing a normal SQL update against postgres.
> Seems to be replacing \\ with \ when it gets saved in the database. eg.
> \\machine\folder is being replaced with \machine
>
> Any ideas?

The backslash (\) character is used to escape other characters from normal 
interpretation, so you can have a text value: 'Richard\'s text' which means 
during processing the backslash is removed.

If you want to actually have a backslash in your sql you'll need to escape it 
too. So you'll have something like:

INSERT INTO foo (path) VALUES ('\\\\machine\\folder');

Most application languages offer something like a quote_sql() function which 
handles all the details of this for you.

-- 
  Richard Huxton



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-11-15 18:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-15 07:23 Does Postgres replace \\ with \ in an update query Vaughn Cleminson <vaughn@the-i-junction.com.removethis>
2002-11-15 18:48 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox