agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
Setting the Field Separator in PSQL
6+ messages / 3 participants
[nested] [flat]

* Setting the Field Separator in PSQL
@ 2015-04-07 20:39  Osborn, Marty <marty.osborn@rsa.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Osborn, Marty @ 2015-04-07 20:39 UTC (permalink / raw)
  To: pgsql-sql

I need to change the field separator to a tab in an input SQL file.

I've tried every combination of tab, '\t', "\t", --field-separator='\t', etc, etc.

Should it be in the command line or in the SQL file?
Any help?

Marty
________________________________
[cid:image001.jpg@01D07148.FA5AC0E0], The Security Division of EMC
Information Security Services Group



[CISSP]

Marty Osborn, CISSP, RSA CSP
Principal Practice Consultant 214-676-9571
marty.osborn@rsasecurity.com<mailto:marty.osborn@rsasecurity.com>

________________________________
This message contains information that may be confidential and privileged. Unless you are the addressee (or authorized to receive mail for the addressee), you should not use, copy, or disclose to anyone this message or any information contained in this message. If you have received this message in error, please so advise the sender by reply e-mail and delete this message. Thank you for your cooperation.
________________________________

Attachments:

  [image/jpeg] image001.jpg (10.0K, ../../8CB6E5A8E0D688459585A6F52093BC250EBE18@MX104CL02.corp.emc.com/3-image001.jpg)
  download | view image

  [image/jpeg] image002.jpg (1.1K, ../../8CB6E5A8E0D688459585A6F52093BC250EBE18@MX104CL02.corp.emc.com/4-image002.jpg)
  download | view image

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

* Re: Setting the Field Separator in PSQL
@ 2015-04-07 21:36  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Osborn, Marty <marty.osborn@rsa.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Adrian Klaver @ 2015-04-07 21:36 UTC (permalink / raw)
  To: Osborn, Marty <marty.osborn@rsa.com>; pgsql-sql

On 04/07/2015 01:39 PM, Osborn, Marty wrote:
> I need to change the field separator to a tab in an input SQL file.

More information is needed.

What is in the SQL file?

What do you want it to do when you load it?

>
> I’ve tried every combination of tab, ‘\t’, “\t”, --field-separator=’\t’,
> etc, etc.
>
> Should it be in the command line or in the SQL file?
>
> Any help?
>
> Marty
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



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

* Re: Setting the Field Separator in PSQL
@ 2015-04-07 21:48  David G. Johnston <david.g.johnston@gmail.com>
  parent: Osborn, Marty <marty.osborn@rsa.com>
  1 sibling, 1 reply; 6+ messages in thread

From: David G. Johnston @ 2015-04-07 21:48 UTC (permalink / raw)
  To: Osborn, Marty <marty.osborn@rsa.com>; +Cc: pgsql-sql

On Tue, Apr 7, 2015 at 1:39 PM, Osborn, Marty <marty.osborn@rsa.com> wrote:

>  I need to change the field separator to a tab in an input SQL file.
>
>
>
> I’ve tried every combination of tab, ‘\t’, “\t”, --field-separator=’\t’,
> etc, etc.
>
>
>
> Should it be in the command line or in the SQL file?
>
>  Any help?
>
>
>
​More context would helpful but keep in mind that within SQL the expression:

'\t'  is a literal back-slash and a literal "t"

E'\t' is escaped to mean <tab>​

Dealing with the shell complicates the issue so if you can avoid it I
suggest that do avoid it.

David J.

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

* Re: Setting the Field Separator in PSQL
@ 2015-04-07 21:52  David G. Johnston <david.g.johnston@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: David G. Johnston @ 2015-04-07 21:52 UTC (permalink / raw)
  To: Osborn, Marty <marty.osborn@rsa.com>; +Cc: pgsql-sql

On Tue, Apr 7, 2015 at 2:48 PM, David G. Johnston <
david.g.johnston@gmail.com> wrote:

> On Tue, Apr 7, 2015 at 1:39 PM, Osborn, Marty <marty.osborn@rsa.com>
> wrote:
>
>>  I need to change the field separator to a tab in an input SQL file.
>>
>>
>>
>> I’ve tried every combination of tab, ‘\t’, “\t”, --field-separator=’\t’,
>> etc, etc.
>>
>>
>>
>> Should it be in the command line or in the SQL file?
>>
>>  Any help?
>>
>>
>>
> ​More context would helpful but keep in mind that within SQL the
> expression:
>
> '\t'  is a literal back-slash and a literal "t"
>
> E'\t' is escaped to mean <tab>​
>
> Dealing with the shell complicates the issue so if you can avoid it I
> suggest that do avoid it.
>
>
​I should probably have tried my own advice first, and I still haven't, but
the documentation states:

"​"""
fieldsep
Specifies the field separator to be used in unaligned output format. That
way one can create, for example, tab- or comma-separated output, which
other programs might prefer. To set a tab as field separator, type \pset
fieldsep '\t'. The default field separator is '|' (a vertical bar).
​"""​

​So I'm not sure if this report is user-error or documentation error.  A
self-contained test case would help...

David J.​

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

* Re: Setting the Field Separator in PSQL
@ 2015-04-07 21:54  David G. Johnston <david.g.johnston@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: David G. Johnston @ 2015-04-07 21:54 UTC (permalink / raw)
  To: Osborn, Marty <marty.osborn@rsa.com>; +Cc: pgsql-sql

On Tue, Apr 7, 2015 at 2:52 PM, David G. Johnston <
david.g.johnston@gmail.com> wrote:

> On Tue, Apr 7, 2015 at 2:48 PM, David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>
>> On Tue, Apr 7, 2015 at 1:39 PM, Osborn, Marty <marty.osborn@rsa.com>
>> wrote:
>>
>>>  I need to change the field separator to a tab in an input SQL file.
>>>
>>>
>>>
>>> I’ve tried every combination of tab, ‘\t’, “\t”, --field-separator=’\t’,
>>> etc, etc.
>>>
>>>
>>>
>>> Should it be in the command line or in the SQL file?
>>>
>>>  Any help?
>>>
>>>
>>>
>> ​More context would helpful but keep in mind that within SQL the
>> expression:
>>
>> '\t'  is a literal back-slash and a literal "t"
>>
>> E'\t' is escaped to mean <tab>​
>>
>> Dealing with the shell complicates the issue so if you can avoid it I
>> suggest that do avoid it.
>>
>>
> ​I should probably have tried my own advice first, and I still haven't,
> but the documentation states:
>
> "​"""
> fieldsep
> Specifies the field separator to be used in unaligned output format. That
> way one can create, for example, tab- or comma-separated output, which
> other programs might prefer. To set a tab as field separator, type \pset
> fieldsep '\t'. The default field separator is '|' (a vertical bar).
> ​"""​
>
> ​So I'm not sure if this report is user-error or documentation error.  A
> self-contained test case would help...
>
> David J.​
>
>
​sorry...

Two more random thoughts:

Do you maybe need to altering COPY behavior:

​http://www.postgresql.org/docs/9.4/interactive/sql-copy.html

and, if you are indeed focused on "psql OUTPUT" are you making sure you are
specifying the "unaligned" output format?

David J.

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

* Re: Setting the Field Separator in PSQL
@ 2015-04-07 21:57  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Adrian Klaver @ 2015-04-07 21:57 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; Osborn, Marty <marty.osborn@rsa.com>; +Cc: pgsql-sql

On 04/07/2015 02:52 PM, David G. Johnston wrote:
> On Tue, Apr 7, 2015 at 2:48 PM, David G. Johnston
> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>>wrote:
>
>     On Tue, Apr 7, 2015 at 1:39 PM, Osborn, Marty <marty.osborn@rsa.com
>     <mailto:marty.osborn@rsa.com>>wrote:
>
>         I need to change the field separator to a tab in an input SQL
>         file.____
>
>         __ __
>
>         I’ve tried every combination of tab, ‘\t’, “\t”,
>         --field-separator=’\t’, etc, etc.____
>
>         __ __
>
>         Should it be in the command line or in the SQL file?____
>
>         ____
>
>         Any help?____
>
>
>
>     ​More context would helpful but keep in mind that within SQL the
>     expression:
>
>     '\t'  is a literal back-slash and a literal "t"
>
>     E'\t' is escaped to mean <tab>​
>
>     Dealing with the shell complicates the issue so if you can avoid it
>     I suggest that do avoid it.
>
>
> ​I should probably have tried my own advice first, and I still haven't,
> but the documentation states:
>
> "​"""
> fieldsep
> Specifies the field separator to be used in unaligned output format.
> That way one can create, for example, tab- or comma-separated output,
> which other programs might prefer. To set a tab as field separator, type
> \pset fieldsep '\t'. The default field separator is '|' (a vertical bar).
> ​"""​
>
> ​So I'm not sure if this report is user-error or documentation error.  A
> self-contained test case would help...

Well the OP was talking about an input file, so I my suspicion they are 
looking for something like \copy.

>
> David J.​
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



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


end of thread, other threads:[~2015-04-07 21:57 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 20:39 Setting the Field Separator in PSQL Osborn, Marty <marty.osborn@rsa.com>
2015-04-07 21:36 ` Adrian Klaver <adrian.klaver@aklaver.com>
2015-04-07 21:48 ` David G. Johnston <david.g.johnston@gmail.com>
2015-04-07 21:52   ` David G. Johnston <david.g.johnston@gmail.com>
2015-04-07 21:54     ` David G. Johnston <david.g.johnston@gmail.com>
2015-04-07 21:57     ` Adrian Klaver <adrian.klaver@aklaver.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox