Обсуждение: Very minor feature suggestion

Поиск
Список
Период
Сортировка

Very minor feature suggestion

От
"Murphy, Kevin"
Дата:
It might be nice for psql to have a 'htmlcaption' boolean pset option that would wrap the provided title/caption, if
any,in a caption tag in the HTML report output, when using html format. 

Motivation:

When I use:
   \pset title 'Some title'

or
   \C 'Some title'

psql emits the text:
   Title is "Some title".

even when using html format.  This seems more like a diagnostic/annotation (like 'Title is unset', which is what you
getfrom a plain "\pset title") than report output.  For casual use, even "\echo Some title" is more pleasant, except
forpost-processing by scripts, which people are no doubt doing.  When using html format, it would arguably be better
forthe title to be wrapped in a caption tag inside the table itself.  You couldn't change the default behavior, but the
htmlcaption would be a nice option. 

Regards,
Kevin Murphy




Re: Very minor feature suggestion

От
Robert Haas
Дата:
On Thu, Oct 18, 2012 at 12:31 PM, Murphy, Kevin <MURPHYKE@email.chop.edu> wrote:
> It might be nice for psql to have a 'htmlcaption' boolean pset option that would wrap the provided title/caption, if
any,in a caption tag in the HTML report output, when using html format. 
>
> Motivation:
>
> When I use:
>
>     \pset title 'Some title'
>
> or
>
>     \C 'Some title'
>
> psql emits the text:
>
>     Title is "Some title".
>
> even when using html format.  This seems more like a diagnostic/annotation (like 'Title is unset', which is what you
getfrom a plain "\pset title") than report output.  For casual use, even "\echo Some title" is more pleasant, except
forpost-processing by scripts, which people are no doubt doing.  When using html format, it would arguably be better
forthe title to be wrapped in a caption tag inside the table itself.  You couldn't change the default behavior, but the
htmlcaption would be a nice option. 

Gee, why NOT change the default behavior?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: Very minor feature suggestion

От
Peter Eisentraut
Дата:
On Thu, 2012-10-18 at 16:31 +0000, Murphy, Kevin wrote:
> It might be nice for psql to have a 'htmlcaption' boolean pset option that would wrap the provided title/caption, if
any,in a caption tag in the HTML report output, when using html format.
 

I'm not following.  It does do that already:

=> \H
Output format is html.
=> \C 'Some Title'
Title is "Some Title".
=> select 1;
<table border="1"> <caption>Some Title</caption> <tr>   <th align="center">?column?</th> </tr> <tr valign="top">   <td
align="right">1</td></tr>
 
</table>
<p>(1 row)<br />
</p>

What do you wish to change?





Re: Very minor feature suggestion

От
"Murphy, Kevin"
Дата:
On Oct 21, 2012, at 6:02 PM, Peter Eisentraut wrote:
> On Thu, 2012-10-18 at 16:31 +0000, Murphy, Kevin wrote:
>> It might be nice for psql to have a 'htmlcaption' boolean pset option that would wrap the provided title/caption, if
any,in a caption tag in the HTML report output, when using html format. 
>
> I'm not following.  It does do that already


Sorry for not doing due diligence.  These aren't the droids I was looking looking for.  I'm moving along.

I had tuples_only (which killed the captions) and expanded on, so that the results, which were guaranteed to have a
singlerow, would look nice instead of having a "Record 1" prefix.  This is a very special case, and not worth doing
anythingabout, unless it bothers someone that a single row result is prefaced with "Record 1" in expanded mode. 

I was doing reports like this:

\pset expanded
\pset footer
\pset format html
\pset tuples_only

\C 'All Samples'
select (select count(distinct blinded_id) from core_person) as "Individuals",      (select count(*) from core_sample)
as"Samples",      (select count(distinct uploaded_data_file_id) from core_samplefile) as "Genomic files mapped to a
sample/person",     (select count(distinct sample_id) from core_samplefile) as "Samples with genomic files",
(selectcount(distinct person_id) from core_samplefile join core_sample on core_samplefile.sample_id = core_sample.id)
as"Individuals with genomic files",      (select count(distinct person_id) from core_blindfile) as "Individuals with
analysisfiles"; 

\pset expanded
\pset footer
\pset format aligned
\pset tuples_only

-Kevin