Обсуждение:

Поиск
Список
Период
Сортировка

От
Zuoxin.Wang@kp.org
Дата:

Hi all,
Does any one know why I have following inconsistant results from PostgreSQL?
Thanks in advance.
 
test=# select birthday from patient;
  birthday
------------
 1960-02-01
 1960-02-01
(2 rows)

test=# select used from patient;
 used
------
 N
 N
(2 rows)


test=# select  first_name, last_name, used, birthday from patient;
 first_name | last_name | used |  birthday
------------+-----------+------+------------
   | 1960-02-01DI       | N
   | 1960-02-01DI       | N
(2 rows)

test=# select  first_name, last_name, birthday, used from patient;
 first_name | last_name |  birthday  | used
------------+-----------+------------+------
 AAAAAA     | TDI       | 1960-02-01 | N
 AAAAAB     | TDI       | 1960-02-01 | N
(2 rows)

test=#

Jason

Re:

От
Alvaro Herrera
Дата:
On Tue, Apr 19, 2005 at 01:27:09PM -0700, Zuoxin.Wang@kp.org wrote:

> test=# select used from patient;
>  used
> ------
>  N
>  N
> (2 rows)

Try

select '{' || used || '}' from patient;

> test=# select  first_name, last_name, used, birthday from patient;
>  first_name | last_name | used |  birthday
> ------------+-----------+------+------------
>    | 1960-02-01DI       | N
>    | 1960-02-01DI       | N
> (2 rows)

Looks like you have some non-printable character in the used column.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"La conclusión que podemos sacar de esos estudios es que
no podemos sacar ninguna conclusión de ellos" (Tanenbaum)

Re:

От
Scott Marlowe
Дата:
It looks like you have some non-printing characters (like ansi
positioning characters or something) in your data.

On Tue, 2005-04-19 at 15:27, Zuoxin.Wang@kp.org wrote:
> Hi all,
> Does any one know why I have following inconsistant results from
> PostgreSQL?
> Thanks in advance.
>
> test=# select birthday from patient;
>   birthday
> ------------
>  1960-02-01
>  1960-02-01
> (2 rows)
>
> test=# select used from patient;
>  used
> ------
>  N
>  N
> (2 rows)
>
>
> test=# select  first_name, last_name, used, birthday from patient;
>  first_name | last_name | used |  birthday
> ------------+-----------+------+------------
>    | 1960-02-01DI       | N
>    | 1960-02-01DI       | N
> (2 rows)
>
> test=# select  first_name, last_name, birthday, used from patient;
>  first_name | last_name |  birthday  | used
> ------------+-----------+------------+------
>  AAAAAA     | TDI       | 1960-02-01 | N
>  AAAAAB     | TDI       | 1960-02-01 | N
> (2 rows)
>
> test=#
>
> Jason

Re:

От
Michael Fuhr
Дата:
On Tue, Apr 19, 2005 at 01:27:09PM -0700, Zuoxin.Wang@kp.org wrote:
>
> test=# select  first_name, last_name, used, birthday from patient;
>  first_name | last_name | used |  birthday
> ------------+-----------+------+------------
>    | 1960-02-01DI       | N
>    | 1960-02-01DI       | N
> (2 rows)

I'd guess that the "used" columns contain carriage returns.  What
do you see if you run the following query?

SELECT replace(used, '\r', '\\r'), length(used) FROM patient;

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re:

От
Steve Crawford
Дата:
On Tuesday 19 April 2005 1:46 pm, Alvaro Herrera wrote:
> Looks like you have some non-printable character in the used
> column.

I concur. Alternately you can (assuming you're running *nix which
probably has xxd and more) try this to see exactly what is in the
data:

psql -c "select * from patient" | xxd | more

Cheers,
Steve

Re:

От
Zuoxin.Wang@kp.org
Дата:

Thanks Alvaro, you are right. Appreciate your quick help.


Jason





Alvaro Herrera <alvherre@dcc.uchile.cl>

04/19/2005 01:46 PM

       
        To:        Zuoxin Wang/CA/KAIPERM@Kaiperm
        cc:        pgsql-admin@postgresql.org
        Subject:        Re: [ADMIN]



On Tue, Apr 19, 2005 at 01:27:09PM -0700, Zuoxin.Wang@kp.org wrote:

> test=# select used from patient;
>  used
> ------
>  N
>  N
> (2 rows)

Try

select '{' || used || '}' from patient;

> test=# select  first_name, last_name, used, birthday from patient;
>  first_name | last_name | used |  birthday
> ------------+-----------+------+------------
>    | 1960-02-01DI       | N
>    | 1960-02-01DI       | N
> (2 rows)

Looks like you have some non-printable character in the used column.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"La conclusión que podemos sacar de esos estudios es que
no podemos sacar ninguna conclusión de ellos" (Tanenbaum)