Thread: Inserting a tab character

Inserting a tab character

From
"Luke Pascoe"
Date:
I have a table which defines various possible file delimiters (CHAR(1) NOT
NULL), for the moment it'll only contain comma and tab. Inserting a comma is
easy, but inserting a tab is proving somewhat more difficult.

How do I do it in 'psql'?

Luke Pascoe.




Re: Inserting a tab character

From
Matthew Horoschun
Date:
Hi Luke.

On Wednesday, February 5, 2003, at 02:39  PM, Luke Pascoe wrote:

> I have a table which defines various possible file delimiters (CHAR(1) 
> NOT
> NULL), for the moment it'll only contain comma and tab. Inserting a 
> comma is
> easy, but inserting a tab is proving somewhat more difficult.
>
> How do I do it in 'psql'?

insert into test values( '\t' );

appears to work...


Matt.



Re: Inserting a tab character

From
Ludwig Lim
Date:
--- Luke Pascoe <luke.p@kmg.co.nz> wrote:
> I have a table which defines various possible file
> delimiters (CHAR(1) NOT
> NULL), for the moment it'll only contain comma and
> tab. Inserting a comma is
> easy, but inserting a tab is proving somewhat more
> difficult.
> 
> How do I do it in 'psql'?
> 
 --> Try using '\t' for tab.
Example :  INSERT INTO table1(f1) values ('\t');
  I'm not sure if inserting a TAB character will
cause some side-effects for commands like COPY FROM /
TO since these commands use tab to delimit fields.

Hope that helps,

ludwig

Hope that helps,
ludwig.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


Re: Inserting a tab character

From
Christoph Haller
Date:
>
> --- Luke Pascoe <luke.p@kmg.co.nz> wrote:
> > I have a table which defines various possible file
> > delimiters (CHAR(1) NOT
> > NULL), for the moment it'll only contain comma and
> > tab. Inserting a comma is
> > easy, but inserting a tab is proving somewhat more
> > difficult.
> >
> > How do I do it in 'psql'?
> >
>
>   --> Try using '\t' for tab.
> Example :
>    INSERT INTO table1(f1) values ('\t');
>
>    I'm not sure if inserting a TAB character will
> cause some side-effects for commands like COPY FROM /
> TO since these commands use tab to delimit fields.
>
If you want to be on the safe side on COPY commands,
you could change to BYTEA type.
'\t' still works on INSERT, only on retrieval it would show up as
'\011'.

Regards, Christoph