From: Platon Pronko <platon7pronko@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: very long record lines in expanded psql output
Date: Thu, 5 Aug 2021 16:30:48 +0300
Message-ID: <bb82e090-2587-5a64-003e-7203db5730fd@gmail.com> (raw)
In-Reply-To: <CAFj8pRBc5tkHzFo4R2EP51tYcjFx1CAuRCzYjT31RvWNktWJSA@mail.gmail.com>
References: <f03d38a3-db96-a56e-d1bc-dbbc80bbde4d@gmail.com>
<CAFj8pRBJ8bcTga9qTYG_v25BfeCB=4+GNc1rbf94qex_3C_e-A@mail.gmail.com>
<27f30f68-c4bd-2f02-080c-8feb0b6eded3@gmail.com>
<CAFj8pRBc5tkHzFo4R2EP51tYcjFx1CAuRCzYjT31RvWNktWJSA@mail.gmail.com>
Hi!
> a) with line cursor
Tried in different configurations, seems that line cursor works fine.
> b) format detection - I try to detect the header line - and I expect this
> line has the most length of all lines. I use a line with the same length as
> the column's type info (data, border).
I looked at pspg source, and here's what I found (please correct me if some/all
of my assumptions are wrong):
1. Input handling and format detection happens in table.c readfile().
2. There's some variables in DataDesc - maxx and maxbytes - that store the
longest line seen so far. But they are re-updated on each new row, so the fact
that header is shorter shouldn't affect them.
3. Expanded header detection is handled by is_expanded_header function. It has
ei_minx and ei_maxx return pointers, but when it is used from readfile() these
pointers are set to NULL in both cases - so header length is simply ignored.
> Did you test the wrapped format? It is working
>
> \pset format wrapped
> \x
> select * from pg_class;
There's no difference in outputs in wrapped format, so pspg behavior is also unaffected.
By the way, it seems that pspg recommends setting \pset border 2 anyway, so in vast
majority of cases there should be no possibility of difference at all - proposed patch
doesn't change output for \pset border 2 (because there's no sane way of making it
look okay in presence of long fields anyway).
Best regards,
Platon Pronko
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: platon7pronko@gmail.com, pavel.stehule@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: very long record lines in expanded psql output
In-Reply-To: <bb82e090-2587-5a64-003e-7203db5730fd@gmail.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