Thread: tab delimiter in output
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 ?
regards
mk
mk
2013/11/25 Marcin Krawczyk <jankes.mk@gmail.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
Marcin Krawczyk, 25.11.2013 12:14: > 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 ? > Which SQL tool do you use? Maybe your SQL client simply doesn't display the tab character?
Thanks, but it didn't change the output.
2013/11/25 Ian Lawrence Barwick <barwick@gmail.com>
2013/11/25 Marcin Krawczyk <jankes.mk@gmail.com>:Try:> 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 ?
SELECT 'aa' || E'\t' || 'bb';
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE
Regards
Ian Barwick
This might be the case. I'm using pgAdmin but I can't find anything in it's configuration.
2013/11/25 Thomas Kellerer <spam_eater@gmx.net>
Marcin Krawczyk, 25.11.2013 12:14:Which SQL tool do you use?> 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 ?
>
Maybe your SQL client simply doesn't display the tab character?
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
hi Marcin, try that for two tabs : select concat('===[' , E'\t\t',']==='); select '===['|| E'\t\t'||']==='; cheers On 11/25/2013 12:14 PM, Marcin Krawczyk wrote: > 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 ? > > > regards > mk