Re: Inserting a path into Database

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Ranieri Mazili <ranieri(dot)oliveira(at)terra(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: Inserting a path into Database
Date: 2007-06-04 21:15:21
Message-ID: 404C8822-2316-42F2-96D0-B89EFDC5F0F7@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql


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/interactive/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/interactive/runtime-config-
compatible.html#GUC-STANDARD-CONFORMING-STRINGS

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Erik Jones 2007-06-04 21:36:40 Re: Large Database \d: ERROR: cache lookup failed for relation ...
Previous Message David Fetter 2007-06-04 21:15:19 Re: Transactional DDL

Browse pgsql-sql by date

  From Date Subject
Next Message Guy Rouillier 2007-06-04 22:54:55 Re: Encrypted column
Previous Message Kristo Kaiv 2007-06-04 21:08:28 Re: current_date / datetime stuff