From: Paul Lambert <paul.lambert@autoledgers.com.au>
To: pgsql-sql@postgresql.org
Subject: Using escape strings in an insert statement.
Date: Tue, 03 Jul 2007 06:45:20 +0800
Message-ID: <46898000.7030601@autoledgers.com.au> (raw)
I'm having a little glitch in using escape strings within strings.
The following will best explain my issue:
tester=# create table testing (test_text text);
CREATE TABLE
tester=# insert into testing (test_text) values ('abc\\123');
WARNING: nonstandard use of \\ in a string literal
LINE 1: insert into testing (test_text) values ('abc\\123');
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
INSERT 0 1
^^^ This works, but I still get an error/warning telling me to use E'\\'
- which I do:
tester=# insert into testing (test_text) values ('abcE'\\'123');
Invalid command \. Try \? for help.
tester(#
^^^ And this just doesn't work at all.
The help itself (ch 4.1.2.1) tells me to use double backslash "Thus, to
include a backslash character, write two backslashes (\\). "
Which one is the correct syntax and how can I make it not return
anything other than a successful insert?
Noob question, I know...
But TIA.
(Version is 8.2.3 on Weenblowz if that is of any relevance)
--
Paul Lambert
Database Administrator
AutoLedgers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: paul.lambert@autoledgers.com.au
Subject: Re: Using escape strings in an insert statement.
In-Reply-To: <46898000.7030601@autoledgers.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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