Re: Patch: Improve Boolean Predicate JSON Path Docs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Patch: Improve Boolean Predicate JSON Path Docs
Дата
Msg-id 2860460.1705698926@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Patch: Improve Boolean Predicate JSON Path Docs  ("David E. Wheeler" <david@justatheory.com>)
Ответы Re: Patch: Improve Boolean Predicate JSON Path Docs  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Re: Patch: Improve Boolean Predicate JSON Path Docs  (Erik Wienhold <ewie@ewie.name>)
Список pgsql-hackers
"David E. Wheeler" <david@justatheory.com> writes:
> [ v7-0001-Improve-boolean-predicate-JSON-Path-docs.patch ]

I started to review this, and got bogged down at

@@ -17203,9 +17214,12 @@ array w/o UK? | t

   <para>
    For example, suppose you have some JSON data from a GPS tracker that you
-   would like to parse, such as:
+   would like to parse, such as this JSON, set up as a
+   <link linkend="app-psql-meta-command-set"><application>psql</application>
+   <command>\set</command> variable</link> for use as <literal>:'json'</literal>
+   in the examples below:
 <programlisting>
-{
+ \set json '{
   "track": {
     "segments": [
       {

I find the textual change rather unwieldy, but the bigger problem is
that this example doesn't actually work.  If you try to copy-and-paste
this into psql, you get "unterminated quoted string", because psql
metacommands can't span line boundaries.

Perhaps we could leave the existing display alone, and then add

    To follow the examples below, paste this into psql:
    <programlisting>
    \set json '{ "track": { "segments": [ { "location": [ 47.763, 13.4034 ], "start time": "2018-10-14 10:05:14", "HR":
73}, { "location": [ 47.706, 13.2635 ], "start time": "2018-10-14 10:39:21", "HR": 135 } ] }}' 
    </programlisting>
    This will allow <literal>:'json'</literal> to be expanded into the
    above JSON value, plus suitable quoting.

However, I'm not sure that's a great solution, because it's going to
line-wrap on most displays, making copy-and-paste a bit iffy.

I experimented with

SELECT '
  ... multiline json value ...
' AS json
\gexec

but that didn't seem to work either.  Anybody have a better idea?

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: introduce dynamic shared memory registry
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Patch: Improve Boolean Predicate JSON Path Docs