Thread: Re: [INTERFACES] How to store '

Re: [INTERFACES] How to store '

From
"Ken J. Wright"
Date:
At 02:56 PM 5/10/99 +0200, you wrote:
>"Ken J. Wright" ha scritto:
>
>> You have to preceed each occurence of ' with a \.
>> So "test'string" becomes "test\'string".
>>
>
>SQL92 says that you have to use the ' twice. If you want to write portable
>code, then:
>
>INSERT INTO table1 VALUES('WHAT''S THAT ?');
>and it becomes: WHAT'S THAT ?.

But just to clarify further, that only works with sql. Copy needs the '\'
approach.
So many choices ;-)

Ken



Re: [INTERFACES] How to store '

From
Herouth Maoz
Date:
At 19:38 +0300 on 10/05/1999, Ken J. Wright wrote:


> But just to clarify further, that only works with sql. Copy needs the '\'
> approach.
> So many choices ;-)

Copy doesn't need it at all, because you don't have quotes around the
fields. The following is from my 6.4.2:

testing=> \d test

Table    = test
+-----------------------------+-----------------------------+-------+
|              Field          |              Type           | Length|
+-----------------------------+-----------------------------+-------+
| t                           | text                        |   var |
+-----------------------------+-----------------------------+-------+
testing=> copy test from stdin;
Enter info followed by a newline
End with a backslash and a period on a line by itself.
>> This is a field without a quote.
>> Here the word 'field' is in quotes.
>> Isn't it nice to have one quote in this field?
>> \.
testing=> select * from test;
t
----------------------------------------------
This is a field without a quote.
Here the word 'field' is in quotes.
Isn't it nice to have one quote in this field?
(3 rows)

I hope this convinces you...

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma