Unix Technical Forum

Inserting a path into Database

This is a discussion on Inserting a path into Database within the pgsql Sql forums, part of the PostgreSQL category; --> Hello, I need to insert a path into a table, but because "\" I have a error by postgres, ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 03:27 PM
Ranieri Mazili
 
Posts: n/a
Default Inserting a path into Database

Hello,

I need to insert a path into a table, but because "\" I have a error by
postgres, so how can I insert a path like bellow into a table:

insert into production values ('C:\Program Files\My program');

I appreciate any help
Thanks

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 03:27 PM
Shoaib Mir
 
Posts: n/a
Default Re: Inserting a path into Database

If you are on 8.1 you can use double qoutes ( 'C:\\Program Files\\My
program' ) on in 8.2 you can use the new "backslash_quote (string)"
setting.

You can find help on "backslash_quote (string)" at -->
http://www.postgresql.org/docs/curre...ompatible.html

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 6/4/07, Ranieri Mazili <ranieri.oliveira@terra.com.br> wrote:
>
> Hello,
>
> I need to insert a path into a table, but because "\" I have a error by
> postgres, so how can I insert a path like bellow into a table:
>
> insert into production values ('C:\Program Files\My program');
>
> I appreciate any help
> Thanks
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 03:27 PM
Michael Glaesemann
 
Posts: n/a
Default Re: [GENERAL] Inserting a path into Database


On Jun 4, 2007, at 15:10 , Ranieri Mazili wrote:

> I need to insert a path into a table, but because "\" I have a
> error by postgres, so how can I insert a path like bellow into a
> table:
>
> insert into production values ('C:\Program Files\My program');


In v8.0 and later you can use dollar-quoted strings, e.g.,

select $_$C:\Program Files\My program$_$;
?column?
-----------------------------
C:\Program Files\My program

http://www.postgresql.org/docs/8.2/i...ve/sql-syntax-
lexical.html#SQL-SYNTAX-DOLLAR-QUOTING

For 8.2, you can turn on standard_conforming_strings in
postgresql.conf so \ will be treated literally:

http://www.postgresql.org/docs/8.2/i...untime-config-
compatible.html#GUC-STANDARD-CONFORMING-STRINGS

Michael Glaesemann
grzm seespotcode net



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com