Print query results when using format=alinged, instead of open them in EDITOR - postgresql

If a do a select and only retrieve a few columns, the results are printed to the terminal, if I have more columns, and they do not fit in the terminal width, the query results are opened in the default editor (vim), but when I exit the editor the results are no longer visible.
I know I can user \x (but I have many rows, and for my it's seems worst ).
If I change the format to unaligned, html, latex or troff-ms even if the results are wider then the terminal width they are still printed.
When the resulted rows do not fit in the terminal height they are always opened in the default EDITOR, no mater what format I am using.
Q:
There is any posibility to use format=aligned and allways print the results instead of opening them in the default EDITOR, so I will not loose their visibility (something similar to what mysql-client does) ?
Thank you.

The query results are passed to the PAGER program when they don't fit in the screen, unless it's disabled with \pset pager off. EDITOR is used for input.
Some pagers restore the previous display when they quit, and it can be quite irritating when you need to use previous results in further queries.
I've found PAGER="less -FX" to be a good fit with psql since it allows scrolling in both directions and keeps the display intact when it quits.

Related

Is there a way to toggle word wrapping for the Output window in VS Code?

I've been working with large print statements in VS Code recently and was wondering: is there was an easy way to turn on word wrapping in the OUTPUT window rather than having to use a horizontal scroll bar?
In a situation where I'm printing a string with hundreds of characters, I would like it to be able to wrap around the output window properly.
There is an editor word wrap setting but I have not been able to find anything that actually affects the output window.

How customize results in Recoll?

Please tell me how to display in the result sheet the full string of the word you are looking for, and not in pieces as in default in Recoll,I'll try in more detail:
I have recoll installed on my computer (which uses Xapian).
There are so many files.
I want to use recall as an alternative to grep
I indexed my data and search, but in the resultant window I do not like the output:
I want the whole row to be highlighted as if in a grepe, where I have the search word and output it immediately to the Result Sheet.
And now it looks like it gives out a piece of text where the searched word is found, but only partially, then it is divided by several points and again a piece of text, and again. You can see an example in the image, for example here (default settings) https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2018/01/Screenshot-Recoll.jpg?resize=768%2C596&ssl=1
This is how recoll works. It shows you "snippets" of text around the search hits. You can adjust the snippets parameters (size and number of context words) in the preferences Gui Configuration, Search Parameters section. You can also hit Preview, and then shift down/up arrows, to browse the result documents previews, for a more complete view.

Microsoft Word->Field Code->{TC}

So I am having a problem. This is what I can create on one of my laptop:
On another, when I created something that has {TC} in it, the whole field code disappeared.
For the example above, if on the other computer, both are running Office 2010,
I can input the code to create the table of content from:
{TOC \f \h \z \f 1\t "Heading 1,1,Heading 2,2,Heading 3,3,Title,1}
to
{TC}
The moment I type in TC, the whole {} disappears.
Other field codes work just fine, except for {TC}. So my question is how do I get {TC} to show on my other laptop?
Thank you for your time.
Apparently, I found my answer.
When I searched google for my answer, most sites give this as a solution:
For Word 2010, go to File->Options->Advanced
Under Show document contents: Select "Show field code instead of their values"
This is the equivalent of pressing Alt+F9, which DID NOT solve my problem.
Apparently, the solution to get {TC} to show in your document is in:
go to File->Options->Display
and check to always show HIDDEN TEXT.
I hope this helps someone in the future.
Yeah, the disappearing TC code is annoying at first -- seems like it's broken. Other codes work, but why does that disappear, even if entering manually? Word instantly sets TC code to Hidden, even the field code itself.
To temporarily toggle this visible without permanently changing your display to show Hidden Text, you can use the normal Ctrl-Shift-8, which toggles display of spaces, paragraph marks, tabs, and Hidden Text, on and off. This is a good keyboard shortcut to have in your standard back of tricks anyway. It is frequent in Word that you need to toggle paragraph marks on and off, because paragraph formatting is attached to the Paragraph mark, and when they're hidden, it can be tricky to fix various formatting issues.
The original post was a few years ago, but I fear things have gotten worse since then, not better. I am using Word 365 v2201, which should be up to date. The other day, I wasted hours on trying to resolve this issue with TC field codes.
First I tried entering them using Insert > Quick Parts > Field. Word creates what looks like a field code, but it behaves as normal text. Messing around with the various controls to toggle field display and hidden text etc etc, has absolutely no effect. It is basically a faux field. And of course, it is completely ignored when compiling the TOC.
Next, I tried entering it manually, by using Ctrl + F9 to either create a blank field or convert some existing text into a field. Same result as above.
As with the original post, this seems to afflict only the TC field code. Other codes work fine, including TOC. And if I create a TOC field, then edit the code to TC, it immediately loses its properties as a field. If I then put the O back in, it immediately behaves as a field once again. Unlike in the original post, adjusting the settings for field display and/or hidden text, have no impact.
In the end, the only solution was to create the field using Alt + Shift + o to open the Mark Table of Contents Entry dialog box. And finally, this works!

Slowing down MongoDB shell output for large documents?

I am trying to inspect a document that is larger than the print buffer for the Windows command window. For some queries more allows you to type it for more output. Is there a way to apply this to other commands?
For instance I might do db.coll.findOne() which greatly surpasses the print buffer. I'd like to see as much as fits, type it, see more, etc.
You could use this workaround:
Make a file with your command... i.e. tmp.txt containing
db.coll.findOne()
Then execute the query via command line - piping the output to an output text file like this:
mongo yourDatabaseName < tmp.txt > output.txt
You can always extend you windows terminal's buffer.
At left top corner, click right mouse button and select properties.
At layout tab, you can change "Screen buffer size" to width 9999 and height 9999, that's quite big scroll back buffer...
Same time you can enlarge your "window size" to cover whole screen (if you want) and change your font to smaller (you can fit more text to screen).

Select * from showing blank in PSQL shell after changing data type to binary

I'm using Ecto/Elixir with Postgres and I created a field with the binary datatype. Everything is working OK except that now when I make a simple query: Select * from "table name"; the sql shell shows only blank and seems that didn't like it...
What should I do to see these contents?
By default, psql display contents in cells aligned inside a grid. Each column is made wide enough to accodomate the largest value in it, and the smaller contents get blank-padded. When a column is much wider than the size of its containing window, entire pages of contents appear to be blank because of all the padding inside giant column(s) and the wrapping across consecutive lines.
The simplest workaround against that is to turn off alignement, with
\pset format unaligned or the on/off shortcut \a
Sometimes it's also interesting to use horizontal scrolling. Personally I use less as a pager with LESS=-FX as options and occasionally run inside psql:
\setenv LESS -FXS
then when displaying a result larger than the window, it does not wrap horizontally and the left and right cursor keys allow to scroll horizontally.
Also even when not using -S and when horizontal wrapping occurs, it's still possible with less to switch to horizontal scrolling/paging by hitting the right cursor key → or ESC) :
ESC-) or RIGHTARROW
Scroll horizontally right N characters, default half the screen width (see the -#
option). If a number N is specified, it becomes the default for future RIGHTARROW
and LEFTARROW commands. While the text is scrolled, it acts as though the -S option
(chop lines) were in effect.