pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to store '
8+ messages / 7 participants
[nested] [flat]

* How to store '
@ 1999-05-07 20:02 Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>
  1999-05-07 20:16 ` Re: [INTERFACES] How to store ' Gregory W Burnham <gburnham@sfu.ca>
  1999-05-08 03:15 ` Re: [INTERFACES] How to store ' Brett W. McCoy <bmccoy@lan2wan.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Henk Jan Barendregt @ 1999-05-07 20:02 UTC (permalink / raw)
  To: pgsql-interfaces


Hello,

Is there a way to store a string with the ' character in it ?
I have to import a database with a lot of strings containing the '
character.
If it is not possible i should write a script to replace them with a `
char.

Thanks in advance,

Henk Jan



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [INTERFACES] How to store '
  1999-05-07 20:02 How to store ' Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>
@ 1999-05-07 20:16 ` Gregory W Burnham <gburnham@sfu.ca>
  1 sibling, 0 replies; 8+ messages in thread

From: Gregory W Burnham @ 1999-05-07 20:16 UTC (permalink / raw)
  To: Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>; pgsql-interfaces

You can store the single quote if you escape it first:

This\'s a string that will work

Gregory W Burnham
Software Engineer /
Systems Administrator
Excite Labs
Simon Fraser University
Vancouver, BC
V5A 1S6
604 291 3615 ph
604 291 5679 fx
----- Original Message ----- 
From: Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>
To: <pgsql-interfaces@postgreSQL.org>
Sent: Friday, May 07, 1999 1:02 PM
Subject: [INTERFACES] How to store '


> 
> Hello,
> 
> Is there a way to store a string with the ' character in it ?
> I have to import a database with a lot of strings containing the '
> character.
> If it is not possible i should write a script to replace them with a `
> char.
> 
> Thanks in advance,
> 
> Henk Jan
> 
> 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [INTERFACES] How to store '
  1999-05-07 20:02 How to store ' Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>
@ 1999-05-08 03:15 ` Brett W. McCoy <bmccoy@lan2wan.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Brett W. McCoy @ 1999-05-08 03:15 UTC (permalink / raw)
  To: Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>; +Cc: pgsql-interfaces

On Fri, 7 May 1999, Henk Jan Barendregt wrote:

> Is there a way to store a string with the ' character in it ?
> I have to import a database with a lot of strings containing the '
> character.
> If it is not possible i should write a script to replace them with a `
> char.

Escape it with \.

Brett W. McCoy           
                                        http://www.lan2wan.com/~bmccoy/
-----------------------------------------------------------------------
Many people write memos to tell you they have nothing to say.




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [INTERFACES] How to store '
@ 1999-05-07 20:21 Ken J. Wright <ken@ori-ind.com>
  1999-05-10 12:56 ` Re: [INTERFACES] How to store ' José Soares <jose@sferacarta.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Ken J. Wright @ 1999-05-07 20:21 UTC (permalink / raw)
  To: Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>; +Cc: pgsql-interfaces

You have to preceed each occurence of ' with a \.
So "test'string" becomes "test\'string".

Cheers!

Ken

At 08:02 PM 5/7/99 +0000, you wrote:
>
>Hello,
>
>Is there a way to store a string with the ' character in it ?
>I have to import a database with a lot of strings containing the '
>character.
>If it is not possible i should write a script to replace them with a `
>char.
>
>Thanks in advance,
>
>Henk Jan
>




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [INTERFACES] How to store '
  1999-05-07 20:21 Re: [INTERFACES] How to store ' Ken J. Wright <ken@ori-ind.com>
@ 1999-05-10 12:56 ` José Soares <jose@sferacarta.com>
  1999-05-10 15:50   ` Re: [INTERFACES] How to store ' abdelkrim <haj@idianet.net>
  0 siblings, 1 reply; 8+ messages in thread

From: José Soares @ 1999-05-10 12:56 UTC (permalink / raw)
  To: Ken J. Wright <ken@ori-ind.com>; +Cc: Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>; pgsql-interfaces

"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 ?.

______________________________________________________________
PostgreSQL 6.5.0 on i586-pc-linux-gnu, compiled by gcc 2.7.2.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jose'





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [INTERFACES] How to store '
  1999-05-07 20:21 Re: [INTERFACES] How to store ' Ken J. Wright <ken@ori-ind.com>
  1999-05-10 12:56 ` Re: [INTERFACES] How to store ' José Soares <jose@sferacarta.com>
@ 1999-05-10 15:50   ` abdelkrim <haj@idianet.net>
  0 siblings, 0 replies; 8+ messages in thread

From: abdelkrim @ 1999-05-10 15:50 UTC (permalink / raw)
  To: pgsql-interfaces

Hello

when I insert a complex numbre in a table of complex, psql  give me some
error :

pqReadData() -- backend closed the channel unexpectedly.
 This probably means the backend terminated abnormally before or while
processing the request.
We have lost the connection to the backend, so further processing is
impossible.  Terminating.

thanks





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [INTERFACES] How to store '
@ 1999-05-10 16:38 Ken J. Wright <ken@ori-ind.com>
  1999-05-11 09:16 ` Re: [INTERFACES] How to store ' Herouth Maoz <herouth@oumail.openu.ac.il>
  0 siblings, 1 reply; 8+ messages in thread

From: Ken J. Wright @ 1999-05-10 16:38 UTC (permalink / raw)
  To: pgsql-interfaces

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




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [INTERFACES] How to store '
  1999-05-10 16:38 Re: [INTERFACES] How to store ' Ken J. Wright <ken@ori-ind.com>
@ 1999-05-11 09:16 ` Herouth Maoz <herouth@oumail.openu.ac.il>
  0 siblings, 0 replies; 8+ messages in thread

From: Herouth Maoz @ 1999-05-11 09:16 UTC (permalink / raw)
  To: Ken J. Wright <ken@ori-ind.com>; pgsql-interfaces

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





^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~1999-05-11 09:16 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-05-07 20:02 How to store ' Henk Jan Barendregt <henkjan@barendregt.xs4all.nl>
1999-05-07 20:16 ` Gregory W Burnham <gburnham@sfu.ca>
1999-05-08 03:15 ` Brett W. McCoy <bmccoy@lan2wan.com>
1999-05-07 20:21 Re: [INTERFACES] How to store ' Ken J. Wright <ken@ori-ind.com>
1999-05-10 12:56 ` José Soares <jose@sferacarta.com>
1999-05-10 15:50   ` abdelkrim <haj@idianet.net>
1999-05-10 16:38 Re: [INTERFACES] How to store ' Ken J. Wright <ken@ori-ind.com>
1999-05-11 09:16 ` Herouth Maoz <herouth@oumail.openu.ac.il>

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