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

[PATCH] psql formatting patch (round 2)

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: [PATCH] psql formatting patch (round 2)
Date: 2005-11-26 22:38:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
[Please CC any replies, thanks]

This patch has the same effect as the last one except it now uses the
PQmblen and PQdsplen functions exported by libpq as suggested by Tom.
This clears a lot of stuff from psql's mbprint.c which is a good thing.
This means it should work for all for encodings (though I can't say I
tested them all).

The PQdsplen function in libpq has been improved so it can actually
work and provide the necessary information for formatting. That file
(wchar.c) is actually shared with the backend but the backend doesn't
use the dsplen functions, so it does add some dead code (on top of what
was already there).

Note: this changes the PQdsplen function, it can now return zero or
minus one which was not possible before. It doesn't appear anyone is
actually using the functions other than psql but it is a change. The
functions are not actually documentated anywhere so it's not like we're
breaking a defined interface. The new semantics follow the Unicode

The other uses of PQdsplen in psql (in ReportSyntaxErrorPosition) would
seem to be slightly affected by the change, except it's not clear how
psql should react to control characters in the string it's trying to

Patch available at:

Comments welcome,

Have a nice day,
Martijn van Oosterhout   <kleptog(at)svana(dot)org>
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.


pgsql-patches by date

Next:From: Peter EisentrautDate: 2005-11-26 23:24:01
Subject: Re: Install pg_regress by default
Previous:From: Volkan YAZICIDate: 2005-11-26 19:56:25
Subject: Re: Case Conversion Fix for MB Chars

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