Thread: Psql 'Expanded display (\x)' behaviour

Psql 'Expanded display (\x)' behaviour

From
Ennio-Sr
Date:
Hello!
I'm new to this list and hope it is the right one (I posted to
General and Novice but got no answer).

I know that issues concerning the (erroneously) so called extended ASCII
chars are of partial interest to English speaking people ... so I should
be very grateful if any of you could confirm that:
toggling on/off the 'Expanded display' (in psql) does affect the display
of non-ascii chars.

Regards,
    Ennio.

-----------------------
PS: I'm using:
Linux ...... 2.2.19pre17 #1 Tue Mar 13 22:37:59 EST 2001 i586 unknown
PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.95.4
$ /usr/lib/postgresql/bin/pg_controldata /var/lib/postgres/data
[cut]
LC_COLLATE:                           it_IT
LC_CTYPE:                             it_IT

but tried other charsets with the same result: accented letters display
ok only when 'expanded display' is turned off (in which case, however,
the pager doesn't work!).

Re: Psql 'Expanded display (\x)' behaviour

From
Peter Eisentraut
Date:
Ennio-Sr writes:

> toggling on/off the 'Expanded display' (in psql) does affect the display
> of non-ascii chars.

Not at all.  It's only an alternative table format.

> but tried other charsets with the same result: accented letters display
> ok only when 'expanded display' is turned off (in which case, however,
> the pager doesn't work!).

Perhaps the problem is that the pager does not handle the accented
characters right.

--
Peter Eisentraut   peter_e@gmx.net

Re: Psql 'Expanded display (\x)' behaviour

From
Ennio-Sr
Date:
> Ennio-Sr writes:
>=20
> > toggling on/off the 'Expanded display' (in psql) does affect the display
> > of non-ascii chars.
>=20
> Not at all.  It's only an alternative table format.

Yes, but when I try to display this 'alternative table format' I found
that some of the chars (precisely those not in ascii 0-127) loose the
appearance ('glyph') they have when expanded display is off!

OK, I'll try to better explain what I mean:
I enter my db with $ psql mydb, then _I create a test table:_

mydb=3D#create table pro_chars (code text, glyph text);

and _insert some values:_

mydb=3D#insert into pro_chars values ('ALT+176', '=B0');
mydb=3D#insert into pro_chars values ('ALT+177', '=B1');
mydb=3D#insert into pro_chars values ('ALT+178', '=B2');
mydb=3D#insert into pro_chars values ('ALT+171', '=AB');
mydb=3D#insert into pro_chars values ('ALT+187', '=BB');
mydb=3D#insert into pro_chars values ('ALT+233', '=E9');
mydb=3D#insert into pro_chars values ('A with grave', '=E0');

(I typed the code values as you read them and the glyphs (which won't
display on your screen if you aren't in Latin1, perhaps) pressing in
turn: apostrophe, LeftAltKey + numbers on numerical keypad, apostrophe.)

Finally I _display my table:_

mydb=3D#select * from pro_chars;

and _everything is ok_, i.e. correct glyphs corresponding to the codes
are displayed.

Then I _toggle on the expanded display:_

mydb=3D#\x=20

and again:

mydb=3D#select * from pro_chars;

but (in the glyph column) I get, respectively: 0, 1, 2, +, ;,  , 1

Could you please reproduce this on your PC and see what happens?

> Perhaps the problem is that the pager does not handle the accented
> characters right.

Ehm ... I don't think pager has anything to do with the chars; I quoted
it only to underline the necessity for me to use 'Expanded display on'
as the only mean to see one page at a time, since I verified that pager
is not working with my tables!
It doesn't even work with the display of history: if I do:
mydb=3D# \s
the whole history will scroll on my screen and I'll be able to see last
page only! I read somewhere (/usr/share/doc/postgres-doc?) that pager
is not very reliable as to the correct judgement on where to stop!

Thanks for your attention, Peter.
Regards,
    Ennio.
--=20
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.     \\?=
//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]     (=
=B0|=B0)
[Why to use Win$ozz (I say) if ... "even a fool can do that.             )=
=3D(
 Do something you aren't good at!" (used to say Henry Miller) ]

Re: Psql 'Expanded display (\x)' behaviour

From
Peter Eisentraut
Date:
Ennio-Sr writes:

> mydb=#select * from pro_chars;
> and _everything is ok_, i.e. correct glyphs corresponding to the codes
> are displayed.
> Then I _toggle on the expanded display:_
> mydb=#\x
> and again:
> mydb=#select * from pro_chars;
> but (in the glyph column) I get, respectively: 0, 1, 2, +, ;,  , 1
> Could you please reproduce this on your PC and see what happens?

All the glyphs show correctly on my system.  It is very likely a problem
with your pager, since the expanded display probably does not fit on the
page, so the pager activates, and that is the only way this difference
could arise.

--
Peter Eisentraut   peter_e@gmx.net

Re: Psql 'Expanded display (\x)' behaviour

From
Ennio-Sr
Date:
* Peter Eisentraut <peter_e@gmx.net> [070403, 19:05]:
> Ennio-Sr writes:
> > Could you please reproduce this on your PC and see what happens?
>=20
> All the glyphs show correctly on my system. It is very likely a
> problem with your pager,=20

Hhm!... this is fine for pg but bad news to me :-(

> since the expanded display probably does not fit on the page,
> so the pager activates, and that is the only way this difference
> could arise.

By 'page' do you mean the 24 lines of the screen? In my example, the
entire lot displays in half page, so no need to scroll. I didn't know
'\x' would call the pager: I thought it gave a different appearance to
the page.=20
Anyway, being this the case, is there any chance to check my pager
before re-installing pgres?
Thank you again.
Regards,
    Ennio.

--=20
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.     \\?=
//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]     (=
=B0|=B0)
[Why to use Win$ozz (I say) if ... "even a fool can do that.             )=
=3D(
 Do something you aren't good at!" (used to say Henry Miller) ]

Re: Psql 'Expanded display (\x)' behaviour

From
Ennio-Sr
Date:
* Ennio-Sr <nasr.laili@tin.it> [080403, 00:19]:
> * Peter Eisentraut <peter_e@gmx.net> [070403, 19:05]:
> >=20
> > All the glyphs show correctly on my system. It is very likely a
> > problem with your pager,=20

Sorry to disturb again, but I'm still stuck at this problem: I tried all
possible acm/sfm combinations to no avail. For sure I'm missing some
stupid setting; the problem is which one?
Now, before I definitely give up, is there anybody who could suggest the
correct keyboard and fonts settings for the 'Expanded display' not
messing up the glyphs?
For example, you Peter, who said everything is ok on your system, could
tell me what kind of settings did you have when you tried my tiny db?
Looking forward to here from you.
Regards,
    Ennio.

--=20
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.     \\?=
//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]     (=
=B0|=B0)
[Why to use Win$ozz (I say) if ... "even a fool can do that.             )=
=3D(
 Do something you aren't good at!" (used to say Henry Miller) ]

Re: Psql 'Expanded display (\x)' behaviour

From
Peter Eisentraut
Date:
Ennio-Sr writes:

> For example, you Peter, who said everything is ok on your system, could
> tell me what kind of settings did you have when you tried my tiny db?

Turn off the pager in psql and see if that makes a difference.  Check the
documentation of the pager program.  Check your locale settings.  AFAICT,
I didn't have any special settings enabled.

--
Peter Eisentraut   peter_e@gmx.net

Re: Psql 'Expanded display (\x)' behaviour

From
Ennio-Sr
Date:
* Peter Eisentraut <peter_e@gmx.net> [140403, 01:40]:
>=20
> Turn off the pager in psql and see if that makes a difference.  Check the
> documentation of the pager program.  Check your locale settings.  AFAICT,
> I didn't have any special settings enabled.
>=20

God bless you, Peter!=20
That was it: turning off the pager, characters display well both with
expanded display on or off. Perhaps I should substitute less with lv in
my pager ... Ok, I will look through available documentation and
eventually come back again.
Thank you very much indeed.
    Ennio.
--=20
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.     \\?=
//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]     (=
=B0|=B0)
[Why to use Win$ozz (I say) if ... "even a fool can do that.             )=
=3D(
 Do something you aren't good at!" (used to say Henry Miller) ]

Re: Psql 'Expanded display (\x)' behaviour

From
Ennio-Sr
Date:
* Peter Eisentraut <peter_e@gmx.net> [140403, 01:40]:
> Ennio-Sr writes:
> [cut]=20
>=20
> Turn off the pager in psql and see if that makes a difference.  Check the
> ...=20

Coming back just to tell you what I did to solve my empasse. May be this
could be useful to other newbies ... :-)

As I told you in my previous post, turning the pager off did allow me to
display clearly my test db; however, when I came back to my true db, I
could only read last page (because the pager was off).
After some more readings, here is what I did:
----------------------
1. Being in dos/dbase (cp437) created 'bib_win.txt' file from the *.dbf
2. Copied the txt file in my linux home dir
3. less bib_win.txt   # showed me that accented letters did not display
4. $ consolechars -f /usr/share/consolefonts/iso01.f16.psf.gz
5. $ consolechars -miso01.acm.gz
6. $ cp bib_win.txt bib_lt1.txt    # to have an extra copy to work on
7. $ konwert cp437-iso1 bib_lt1.txt -o bib_lt1.txt
     didn't seem to work well, so I simply did:
8. $ konwert cp437-iso1 bib_lt1.txt -O
9. less bib_lt1.txt    # finally I could see my accented letters!

At this point I switched to psql:

10. $ psql mydb
\! grep -r less /usr/bin/pager    # to make sure that pager used less
                  # (lv didn't work, so I removed it)
\encoding latin1
\i bib_import_lt1.sql      # to import bib_win.txt in a 'raw' pg db
\i bib_crea_lt1.sql      # to take off columns containing delimiters
\x
select autore, titolo, altre_notizie, editore from bib_lt1 where autore lik=
e '%Tour%' ;             # ok, all letters are correctly displayed
\pset pager         # took the pager off
select autore, titolo, altre_notizie, editore from bib_lt1 where autore lik=
e '%Tour%' ;             # but the screen was continuously srolling!
\pset pager         # put back the pager
select autore, titolo, altre_notizie, editore from bib_lt1 where autore lik=
e '%Tour%' ;             # checked again tha everything is ok.
-----------------------
I am not sure weather this is the shortest way to accomplish my task;
the fact is that it seems to work!
At the end of the story, may I add that my expertise in linux and pgres
is not such that I can conclude saying that psql is in some way 'bugged'
as concerns the pager or the /x option; perhaps it only lacks clearer
information on how to set fonts and charsets so as to have things
working smoothly with characters over ascii 127.

Thank you again for your attention and help.
Regards,
    Ennio.

--=20
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.     \\?=
//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]     (=
=B0|=B0)
[Why to use Win$ozz (I say) if ... "even a fool can do that.             )=
=3D(
 Do something you aren't good at!" (used to say Henry Miller) ]