| От | Richard Huxton |
|---|---|
| Тема | Re: Does Postgres replace \\ with \ in an update query |
| Дата | |
| Msg-id | 200211151848.35639.dev@archonet.com обсуждение исходный текст |
| Ответ на | Does Postgres replace \\ with \ in an update query ("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
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера