Thread: funny psql output

funny psql output

From
Bruce Momjian
Date:
Does this look strange to anyone:

test=> create table kk1 (born date);
CREATE
test=> select * from kk1;
born
----
(0 rows)

test=> insert into kk1 values ('1/1/1990');
INSERT 18588 1
test=> select * from kk1;     born
----------
01-01-1990
(1 row)

Look how 'born' is right-shifted in the column.  Any idea why?

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


Re: [HACKERS] funny psql output

From
Tom Lane
Date:
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> test=> insert into kk1 values ('1/1/1990');
> INSERT 18588 1
> test=> select * from kk1;
>       born
> ----------
> 01-01-1990
> (1 row)

> Look how 'born' is right-shifted in the column.  Any idea why?

I think libpq's print routine is deciding that the column is numeric.
(all digits and minus signs ... and IIRC it's not very picky about
where the minus signs are...)

Perhaps Peter will fix this during his massive rewrite.
        regards, tom lane


Re: [HACKERS] funny psql output

From
Bruce Momjian
Date:
> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> > test=> insert into kk1 values ('1/1/1990');
> > INSERT 18588 1
> > test=> select * from kk1;
> >       born
> > ----------
> > 01-01-1990
> > (1 row)
> 
> > Look how 'born' is right-shifted in the column.  Any idea why?
> 
> I think libpq's print routine is deciding that the column is numeric.
> (all digits and minus signs ... and IIRC it's not very picky about
> where the minus signs are...)
> 
> Perhaps Peter will fix this during his massive rewrite.

Oh, that's fine.  I just never realized it did that, but I see it now in
all my numeric columns.  Interesting.

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