On Tuesday, November 22, 2022 at 01:16:02 PM EST, Peter J. Holzer <hjp-pgsql@xxxxxx> 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)
>
> > > \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)
>