Re: psql prompt

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches <pgsql-patches(at)postgreSQL(dot)org>
Subject: Re: psql prompt
Date: 2000-06-09 16:12:52
Message-ID: 200006091612.MAA02892@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Not sure what to do with this patch. It appears most of it was already
applied.

>
> On Thu, 9 Mar 2000, Bruce Momjian wrote:
>
> > Karel, can you submit a new patch to clean up these new items, rather
> > than just an entire new patch.
>
> Here is a new patch (this patch remove my old code from psql.)
> Bruce, will better if Peter check this patch first. He is really
> pedantic :-) But I merit punishment...
>
> > > 1) updates the documentation and the comment on top of the function
>
> Yes.
>
> > >
> > > 2) keeps the correct semantics of %m vs %M
>
> Yes. My code in this patch is corrent for %m (hello) %M (hello.domain.xx).
> But your code is not correct. See TCP/IP connection:
>
> $ ./psql abil -h bootes -U zakkr
>
> abil=# \set PROMPT1 %M:%/%#%32 <-- without a domainname
> bootes:abil# \set PROMPT1 %m:%/%#%32
> bootes:abil#
>
> You use for prompt PQhost(), but in PGconn struct is (probably) save
> hostname from psql's argv[]. But it is not always real and full hostname
> (with domainname) - it can be a name from /etc/hosts. A solution is use
> gethostbyaddr( conn->raddr ) instead simple PQhost().
>
> But it is really cosmetic option. We have propably more interesting a work
> (pg_acl ?) :-)
>
> > > 3) is portable to Windows (you can ifdef it out, since there are no domain
> > > sockets on Windows)
>
> Sorry. It correct now.
>
> > > 4) Uses gethostname. That's more portable.
>
> I used gethostname() and gethostbyname() (for full domain name (%M)).
>
> Well, Peter is all in this patch correct?
>
> Karel
Content-Description:

[ application/x-gzip is not supported, skipping... ]

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Attachment Content-Type Size
unknown_filename text/plain 4.1 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Karel Zak 2000-06-09 16:46:56 Re: psql prompt
Previous Message Bruce Momjian 2000-06-09 16:11:26 Re: NO-CREATE-TABLE and NO-LOCK-TABLE