From: pbj@cmicdo.com <pbj@cmicdo.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
To: Peter J. Holzer <hjp-pgsql@hjp.at>
Subject: Re: copying json data and backslashes
Date: Tue, 22 Nov 2022 19:11:25 +0000 (UTC)
Message-ID: <329136653.2014260.1669144285438@mail.yahoo.com> (raw)
In-Reply-To: <20221122181550.lgobhgfzvtgp7jes@hjp.at>
References: <PAXPR02MB7600EDF4AA4898094EBD8B10E30D9@PAXPR02MB7600.eurprd02.prod.outlook.com>
<1342743333.378397.1669130157980@office.mailbox.org>
<1999020343.1943388.1669131046107@mail.yahoo.com>
<PAXPR02MB7600A3361EE070A23F226481E30D9@PAXPR02MB7600.eurprd02.prod.outlook.com>
<20221122181550.lgobhgfzvtgp7jes@hjp.at>
On Tuesday, November 22, 2022 at 01:16:02 PM EST, Peter J. Holzer <hjp-pgsql@hjp.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)
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: pbj@cmicdo.com, hjp-pgsql@hjp.at
Subject: Re: copying json data and backslashes
In-Reply-To: <329136653.2014260.1669144285438@mail.yahoo.com>
References: <PAXPR02MB7600EDF4AA4898094EBD8B10E30D9@PAXPR02MB7600.eurprd02.prod.outlook.com> <1342743333.378397.1669130157980@office.mailbox.org> <1999020343.1943388.1669131046107@mail.yahoo.com> <PAXPR02MB7600A3361EE070A23F226481E30D9@PAXPR02MB7600.eurprd02.prod.outlook.com> <20221122181550.lgobhgfzvtgp7jes@hjp.at> <329136653.2014260.1669144285438@mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox