Re: copying json data and backslashes

From: "pbj(at)cmicdo(dot)com" <pbj(at)cmicdo(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
Subject: Re: copying json data and backslashes
Date: 2022-11-22 19:11:25
Message-ID: 329136653.2014260.1669144285438@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday, November 22, 2022 at 01:16:02 PM EST, Peter J. Holzer <hjp-pgsql(at)hjp(dot)at> wrote:
 > On 2022-11-22 17:39:04 +0000, Alastair McKinley wrote:
 > > > \copy footable from 'input.json' (format csv, escape '^B', delimieter '^C
', quote '^E')
 > > >
 > > > where the control characters are the actual control char, not the
 > > > caret-letter, and it requires no escaping escapes.  I realize this
 > > > won't work for all
 > > > situations.
 > >
 > > Thanks for the suggestion, this is interesting to me to try but I am
 > > not quite sure how this works.
 > > As far as I understand, escape/quote/delimiter have to be a single
 > > character, and CTRL-C etc. are multiple characters.
 >

Yes, Alastair, Peter said what I would have...

 > You may have to hit several Keys[1] on your keyboard, but Ctrl-C is a
 > single character, just like Shift-C is (the former has code 0003, the
 > latter 0043).
 >
 > On Unix-like systems you can usually type the control characters by
 > typing Ctrl-V first:
 >
 > At the psql prompt, type
 >     select ascii('
 > then hit V while holding the ctrl key
 > then hit C while holding the ctrl key
 > The terminal should display that as ^C
 > then complete the line with
 >     ');
 > so that it looks like
 >     select ascii('^C');
 > and hit return:
 >
 >
 > [1] There are usually four Ctrl-Characters which need only a single
 >     key: Ctrl-I (TAB), Ctrl-M (CR), Ctrl-[ (ESC) and Ctrl-H (BS) or Ctrl-?
 >     (DEL).
 >  
 >     (On Unix systems CR is normally translated to LF, on Windows to CRLF)
 >  

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Erik Wienhold 2022-11-22 19:39:46 Re: copying json data and backslashes
Previous Message Ted Toth 2022-11-22 19:04:22 security label and indexes