Skip site navigation (1) Skip section navigation (2)

Re: printTable API (was: Show INHERIT in \du)

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Subject: Re: printTable API (was: Show INHERIT in \du)
Date: 2008-04-03 16:10:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Hash: SHA1

On 31/03/2008, Tom Lane  wrote:
> "Brendan Jurd"  writes:
>  >  1. describe malloc's the cells to zero, but print just does a local
>  > calloc without any initialisation.
> There isn't any functional difference there.  I am not sure, but I think
>  the reason print.c has its own malloc wrappers instead of depending on
>  common.c's is that we use print.c in some bin/scripts/ programs that
>  do not want common.c too.

Yeah, it looks like createlang and droplang use print.c to emit a list
of installed languages.

>  >  2. describe only does an mbvalidate for WIN32, but print does it in all cases.
> I don't know why describe only does that for WIN32; it looks
>  inconsistent to me too.  Possibly some trolling in the CVS history would
>  give a clue about this.

Well, mbvalidate was originally added to print.c in 2001, as part of a
big patch to add multibyte support to psql [1].  However, it was only
added to describe much later (2003) in response to a bug report about
8-bit  characters not displaying correctly on the Windows console [2].
 I think that because the bug was only observed in Windows, the patch
was added #ifdef WIN32, even though print.c was already using
mbvalidate for all content.

This nicely illustrates the nuisance inherent to duplication of code!

Based on this, I'm going to go ahead with using mbvalidate in all cases.


Version: GnuPG v1.4.7 (GNU/Linux)


In response to

pgsql-hackers by date

Next:From: Pavan DeolaseeDate: 2008-04-03 16:12:48
Subject: Re: [GENERAL] ANALYZE getting dead tuple count hopelessly wrong
Previous:From: Bruce MomjianDate: 2008-04-03 16:07:54
Subject: Re: psql \G command -- send query and output using extended format

pgsql-patches by date

Next:From: Alvaro HerreraDate: 2008-04-03 16:44:04
Subject: Re: psql \G command -- send query and output usingextended format
Previous:From: Gregory StarkDate: 2008-04-03 16:09:49
Subject: Re: psql command aliases support

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group