Re: [HACKERS] expanded mode is still broken
It works perfectly now Thank you Pavel 2014-09-12 16:37 GMT+02:00 Stephen Frost : > Pavel, All, > > * Stephen Frost (sfr...@snowman.net) wrote: > > * Stephen Frost (sfr...@snowman.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 >
Re: [HACKERS] expanded mode is still broken
Pavel, All, * Stephen Frost (sfr...@snowman.net) wrote: > * Stephen Frost (sfr...@snowman.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 diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 34365fd..d6e0487 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -1147,16 +1147,15 @@ cleanup: static void -print_aligned_vertical_line(const printTableContent *cont, +print_aligned_vertical_line(const printTextFormat *format, + const unsigned short opt_border, unsigned long record, unsigned int hwidth, unsigned int dwidth, printTextRule pos, FILE *fout) { - const printTextFormat *format = get_line_style(cont->opt); const printTextLineFormat *lformat = &format->lrule[pos]; - unsigned short opt_border = cont->opt->border; unsigned int i; int reclen = 0; @@ -1435,11 +1434,11 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) lhwidth++; /* for newline indicators */ if (!opt_tuples_only) -print_aligned_vertical_line(cont, record++, lhwidth, - dwidth, pos, fout); +print_aligned_vertical_line(format, opt_border, record++, + lhwidth, dwidth, pos, fout); else if (i != 0 || !cont->opt->start_table || opt_border == 2) -print_aligned_vertical_line(cont, 0, lhwidth, dwidth, - pos, fout); +print_aligned_vertical_line(format, opt_border, 0, lhwidth, + dwidth, pos, fout); } /* Format the header */ @@ -1624,7 +1623,7 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) if (cont->opt->stop_table) { if (opt_border == 2 && !cancel_pressed) - print_aligned_vertical_line(cont, 0, hwidth, dwidth, + print_aligned_vertical_line(format, opt_border, 0, hwidth, dwidth, PRINT_RULE_BOTTOM, fout); /* print footers */ signature.asc Description: Digital signature
Re: [HACKERS] expanded mode is still broken
Pavel, * Stephen Frost (sfr...@snowman.net) wrote: > That said, it looks like it worked in 9.3. Hmm, actually, no, it didn't. sfrost@tamriel:~> psql --version psql (PostgreSQL) 9.3.5 sfrost@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 signature.asc Description: Digital signature
Re: [HACKERS] expanded mode is still broken
Pavel, * Pavel Stehule (pavel.steh...@gmail.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-y7bsfj347...@mail.gmail.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 signature.asc Description: Digital signature