Re: expanded mode is still broken

Lists: pgsql-hackers
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Greg S <stark(at)mit(dot)edu>, Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>
Subject: expanded mode is still broken
Date: 2014-09-12 11:27:35
Message-ID: CAFj8pRDnb+Vyb+oN=x-wZXeLH3yOSBSFuqVcSL=Si4Nmd7nPEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi

I checked HEAD and border formatting is broken

postgres=# \pset border 3
Border style (border) is 3.
postgres=# \l
List of databases
[ RECORD 1 ]-----+----------------------
| Name | postgres |
| Owner | postgres |
| Encoding | UTF8 |
| Collate | en_US.UTF-8 |
| Ctype | en_US.UTF-8 |
| Access privileges | |
[ RECORD 2 ]-----+----------------------
| Name | template0 |
| Owner | postgres |
| Encoding | UTF8 |
| Collate | en_US.UTF-8 |
| Ctype | en_US.UTF-8 |
| Access privileges | =c/postgres +|
| | postgres=CTc/postgres |
[ RECORD 3 ]-----+----------------------
| Name | template1 |
| Owner | postgres |
| Encoding | UTF8 |
| Collate | en_US.UTF-8 |
| Ctype | en_US.UTF-8 |
| Access privileges | =c/postgres +|
| | postgres=CTc/postgres |
-----------------+----------------------

postgres=# \pset linestyle unicode
Line style (linestyle) is unicode.
postgres=# \l
List of databases
[ RECORD 1 ]─────┬──────────────────────
│ Name │ postgres │
│ Owner │ postgres │
│ Encoding │ UTF8 │
│ Collate │ en_US.UTF-8 │
│ Ctype │ en_US.UTF-8 │
│ Access privileges │ │
[ RECORD 2 ]─────┼──────────────────────
│ Name │ template0 │
│ Owner │ postgres │
│ Encoding │ UTF8 │
│ Collate │ en_US.UTF-8 │
│ Ctype │ en_US.UTF-8 │
│ Access privileges │ =c/postgres ↵│
│ │ postgres=CTc/postgres │
[ RECORD 3 ]─────┼──────────────────────
│ Name │ template1 │
│ Owner │ postgres │
│ Encoding │ UTF8 │
│ Collate │ en_US.UTF-8 │
│ Ctype │ en_US.UTF-8 │
│ Access privileges │ =c/postgres ↵│
│ │ postgres=CTc/postgres │
─────────────────┴──────────────────────

Probably not all Sergey's fixes was applied, when I tested it (9.4 with
Sergey' fixes) it works without issues (I though)

Regards

Pavel


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Greg S <stark(at)mit(dot)edu>, Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>
Subject: Re: expanded mode is still broken
Date: 2014-09-12 13:42:57
Message-ID: 20140912134257.GO16422@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel,

* Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
> I checked HEAD and border formatting is broken

I agree that 'border 3' and the ascii / unicode linestyles generates an
odd looking output, however...

[...]

> Probably not all Sergey's fixes was applied, when I tested it (9.4 with
> Sergey' fixes) it works without issues (I though)

I went through all of psql-wrapped-expanded-fix-v5.patch (from
CAJTaR30koAru2tucYiAZ=JjFFi8TZ0K7dhfSY-y7bsFj347zdg(at)mail(dot)gmail(dot)com) and
the whole thing appears to have been applied. There aren't any
regression tests with '\pset border 3' and the documentation indicates
that it's only sensible for HTML (where it simply tranlates into the
border=.. attribute) and latex/latex-longtable. That said, it looks
like it worked in 9.3. I'm guessing there's a case somewhere which
isn't handling border = 3 as identical to border = 2 after these changes.

If there's a specific patch that fixes this, please share a link. I'll
spend a bit of time looking at it, but I'll admit that I've not spent a
lot of time in this code and it isn't exactly the most straight-forward
code in our tree today..

Thanks,

Stephen


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Greg S <stark(at)mit(dot)edu>, Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>
Subject: Re: expanded mode is still broken
Date: 2014-09-12 13:57:35
Message-ID: 20140912135735.GP16422@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel,

* Stephen Frost (sfrost(at)snowman(dot)net) wrote:
> That said, it looks like it worked in 9.3.

Hmm, actually, no, it didn't.

sfrost(at)tamriel:~> psql --version
psql (PostgreSQL) 9.3.5
sfrost(at)tamriel:~> psql -d postgres
psql (9.3.5)
Type "help" for help.

postgres=# \pset expanded
Expanded display is on.
postgres=# \pset border 3
Border style is 3.
postgres=# \l
List of databases
[ RECORD 1 ]-----+----------------------
| Name | postgres |
| Owner | postgres |
| Encoding | UTF8 |
| Collate | en_US.UTF-8 |
| Ctype | en_US.UTF-8 |
| Access privileges | |

...

I've found a few places where we don't treat border >= 2 as the same
border == 2 and if I'm able to make it work then I'll probably go ahead
and commit it, unless anyone objects, but if I run into trouble then
I'll probably just punt on it as I don't know that it really deserves a
lot of effort.

The way the documentation reads for 'border' is pretty terrible though,
in my view, so I'll take a pass at cleaning that up too.

Thanks,

Stephen


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Greg S <stark(at)mit(dot)edu>, Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>
Subject: Re: expanded mode is still broken
Date: 2014-09-12 14:37:02
Message-ID: 20140912143702.GQ16422@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel, All,

* Stephen Frost (sfrost(at)snowman(dot)net) wrote:
> * Stephen Frost (sfrost(at)snowman(dot)net) wrote:
> > That said, it looks like it worked in 9.3.
>
> Hmm, actually, no, it didn't.
[...]

Alright, attached is a patch which fixes it. Barring objections, I'll
go ahead and back-patch this also, since it's clearly wrong and there
was a definite attempt to have this case work (a few places explicitly
reset opt_border to 2 if it's higher, but that wasn't being passed down
to print_aligned_vertical_line, and it wasn't doing it).

Thanks,

Stephen

Attachment Content-Type Size
fix_border3.patch text/x-diff 1.7 KB

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Greg S <stark(at)mit(dot)edu>, Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>
Subject: Re: expanded mode is still broken
Date: 2014-09-12 16:40:09
Message-ID: CAFj8pRBEbMeDQQKsersQz6nP=zCzYgpgnm7hLRBjv6FMea7i0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

It works perfectly now

Thank you

Pavel

2014-09-12 16:37 GMT+02:00 Stephen Frost <sfrost(at)snowman(dot)net>:

> Pavel, All,
>
> * Stephen Frost (sfrost(at)snowman(dot)net) wrote:
> > * Stephen Frost (sfrost(at)snowman(dot)net) wrote:
> > > That said, it looks like it worked in 9.3.
> >
> > Hmm, actually, no, it didn't.
> [...]
>
> Alright, attached is a patch which fixes it. Barring objections, I'll
> go ahead and back-patch this also, since it's clearly wrong and there
> was a definite attempt to have this case work (a few places explicitly
> reset opt_border to 2 if it's higher, but that wasn't being passed down
> to print_aligned_vertical_line, and it wasn't doing it).
>
> Thanks,
>
> Stephen
>