storing windows path strings - Mailing list pgsql-general

From Scott Frankel
Subject storing windows path strings
Date
Msg-id 150B4D08-1FED-4047-AA78-EC798CB8B091@pacbell.net
Whole thread Raw
Responses Re: storing windows path strings  (Cédric Villemain <cedric.villemain.debian@gmail.com>)
List pgsql-general

Hi all,

What's the proper way to store directory path strings in a table, especially ones with backslashes like windows?

I'm currently using a prepared statement with bind value.  Do I need to pre-parse all user entries to identify any backslash characters before passing the string to my insert statement?

Searches through the documentation turned up references to escape_string_warning (boolean) and standard_conforming_strings (boolean).  I'm not sure I'll have access to server side config.  

Thanks in advance!
Scott


eg: 

CREATE TABLE foo (
foo_id SERIAL PRIMARY KEY,
name VARCHAR(32) UNIQUE NOT NULL,
dirpath text DEFAULT NULL);


INSERT INTO foo (name, dirpath) VALUES ('bar', 'c:\windows\path\to\bar');
--> WARNING:  nonstandard use of \\ in a string literal




pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Possible to set postgres in case insensitive mode ?
Next
From: Cédric Villemain
Date:
Subject: Re: storing windows path strings