Re: tab delimiter in output

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: tab delimiter in output
Date: 2013-11-25 11:26:35
Message-ID: CAB8KJ=gXssjEVzgqN8xaoTb=+zoMfHPnXZbhh-17T99vonNxFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2013/11/25 Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com>:
> Hi,
>
> I need to return concatenated columns separated by tab character and I can't
> get it to work. Here's what I tried:
>
> SELECT concat('aa', '\t', 'bb');
> SELECT concat('aa', CHR(9), 'bb');
> SELECT 'aa' || CHR(9) || 'bb';
> SELECT 'aa' || '\t' || 'bb';
>
> I get "aabb" instead of "aa bb" in all cases. Is this a configuration
> issue ?

Try:

SELECT 'aa' || E'\t' || 'bb';

http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE

Regards

Ian Barwick

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2013-11-25 11:42:46 Re: tab delimiter in output
Previous Message Marcin Krawczyk 2013-11-25 11:14:43 tab delimiter in output