Thread: pgsql: Allow psql multi-line column values to align in the proper

pgsql: Allow psql multi-line column values to align in the proper

From
momjian@postgresql.org (Bruce Momjian)
Date:
Log Message:
-----------
Allow psql multi-line column values to align in the proper columns

  If the second output column value is 'a\nb', the 'b' should appear
  in the second display column, rather than the first column as it
  does now.

Change libpq's PQdsplen() to return more useful values.

> 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
> standard.

BACKWARD COMPATIBLE CHANGE.

The only user-visible change I saw in the regression tests is that a
SELECT * on a table where all the columns have been dropped doesn't
return a blank line like before.  This seems like a step forward.

Martijn van Oosterhout

Modified Files:
--------------
    pgsql/src/backend/utils/mb:
        wchar.c (r1.52 -> r1.53)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/wchar.c.diff?r1=1.52&r2=1.53)
    pgsql/src/bin/psql:
        mbprint.c (r1.18 -> r1.19)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/mbprint.c.diff?r1=1.18&r2=1.19)
        mbprint.h (r1.8 -> r1.9)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/mbprint.h.diff?r1=1.8&r2=1.9)
        print.c (r1.79 -> r1.80)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/print.c.diff?r1=1.79&r2=1.80)
    pgsql/src/test/regress/expected:
        alter_table.out (r1.89 -> r1.90)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/alter_table.out.diff?r1=1.89&r2=1.90)
        prepare.out (r1.8 -> r1.9)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/prepare.out.diff?r1=1.8&r2=1.9)

Re: pgsql: Allow psql multi-line column values to align

From
Kris Jurka
Date:

On Thu, 9 Feb 2006, Bruce Momjian wrote:

> Log Message:
> -----------
> Allow psql multi-line column values to align in the proper columns
>

You have not fixed the expected results for the contrib regression tests.

Kris Jurka

Re: pgsql: Allow psql multi-line column values to align

From
Kris Jurka
Date:

On Thu, 9 Feb 2006, Bruce Momjian wrote:

> Log Message:
> -----------
> Allow psql multi-line column values to align in the proper columns
>

There is a problem with this on AIX.

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=asp&dt=2006-02-10%2006:23:00

For tables that have no columns AIX thinks it has an out of memory error.
src/bin/psql/print.c:pg_local_calloc bails out if calloc returns NULL.  I
believe AIX is returning NULL for calloc with a count of zero.  Efforts
are made not to call pg_local_calloc with a count of zero, but one place
is missed, the attached patch fixes that.

Additionally there are a whole lot of of signedness warnings introduced
which I've attached.

Kris Jurka

Attachment

Re: pgsql: Allow psql multi-line column values to align

From
Bruce Momjian
Date:
I think Tom fixed the final difference in pgcryto.  We should be fine now.

---------------------------------------------------------------------------

Kris Jurka wrote:
>
>
> On Thu, 9 Feb 2006, Bruce Momjian wrote:
>
> > Log Message:
> > -----------
> > Allow psql multi-line column values to align in the proper columns
> >
>
> There is a problem with this on AIX.
>
> http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=asp&dt=2006-02-10%2006:23:00
>
> For tables that have no columns AIX thinks it has an out of memory error.
> src/bin/psql/print.c:pg_local_calloc bails out if calloc returns NULL.  I
> believe AIX is returning NULL for calloc with a count of zero.  Efforts
> are made not to call pg_local_calloc with a count of zero, but one place
> is missed, the attached patch fixes that.
>
> Additionally there are a whole lot of of signedness warnings introduced
> which I've attached.
>
> Kris Jurka

Content-Description:

[ Attachment, skipping... ]

Content-Description:

[ Attachment, skipping... ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073