knowledge-database (beta)

Current group: pgsql.bugs

Re: BUG #1392: could not select filter an entry from copied data table

Re: BUG #1392: could not select filter an entry from copied data table  
Michael Fuhr
 Re: BUG #1392: could not select filter an entry from copied data table  
Kanu Patel
From:Michael Fuhr
Subject:Re: BUG #1392: could not select filter an entry from copied data table
Date:Mon, 17 Jan 2005 14:05:46 -0700
On Mon, Jan 17, 2005 at 12:36:33PM -0800, Kanu Patel wrote:

> I had an employee table with the following columns in it: id, name, address, phone, payinfo.
> I had loaded the data using: "copy employee from 'employee.txt';" command.
> I want to get namde of one employee, so I have entered the following command:
> select name from employee where id='1'; This returns zero rows.

Is there an employee with id='1'? What data type is the id column?
If it's a string type (char, varchar, text) then I wonder if the
data has extraneous whitespace. I mentioned this in my original
reply, and I asked you to run a query like the following:

SELECT '<' || id || '>', name FROM employee WHERE id LIKE '%1%';

Please run that query and look closely at whether there are spaces
around the id value. If the query doesn't return what you expect,
then please post the query you ran and show the record you expect
it to match. It might be useful to see that record as the output
of the following command:

pg_dump -t employee -aD | grep 'something'

where 'something' is a pattern that will match the desired record.

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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
From:Kanu Patel
Subject:Re: BUG #1392: could not select filter an entry from copied data table
Date:Tue, 18 Jan 2005 09:54:25 -0800 (PST)
--0-424084311-1106070865=:97372
Content-Type: text/plain; charset=us-ascii

Yes, the employee id=1 and it is text. So I agree with you that could be a space problem. How can I resolve that? May be change id as integer or real?

Thanks.



Michael Fuhr wrote:
On Mon, Jan 17, 2005 at 12:36:33PM -0800, Kanu Patel wrote:

> I had an employee table with the following columns in it: id, name, address, phone, payinfo.
> I had loaded the data using: "copy employee from 'employee.txt';" command.
> I want to get namde of one employee, so I have entered the following command:
> select name from employee where id='1'; This returns zero rows.

Is there an employee with id='1'? What data type is the id column?
If it's a string type (char, varchar, text) then I wonder if the
data has extraneous whitespace. I mentioned this in my original
reply, and I asked you to run a query like the following:

SELECT '<' || id || '>', name FROM employee WHERE id LIKE '%1%';

Please run that query and look closely at whether there are spaces
around the id value. If the query doesn't return what you expect,
then please post the query you ran and show the record you expect
it to match. It might be useful to see that record as the output
of the following command:

pg_dump -t employee -aD | grep 'something'

where 'something' is a pattern that will match the desired record.

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


---------------------------------
Do you Yahoo!?
The all-new My Yahoo! – What will yours do?
--0-424084311-1106070865=:97372
Content-Type: text/html; charset=us-ascii

Yes, the employee id=1 and it is text. So I agree with you that could be a space problem. How can I resolve that? May be change id as integer or real?

 

Thanks.

 



Michael Fuhr <mike@fuhr.org> wrote:

On Mon, Jan 17, 2005 at 12:36:33PM -0800, Kanu Patel wrote:

> I had an employee table with the following columns in it: id, name, address, phone, payinfo.
> I had loaded the data using: "copy employee from 'employee.txt';" command.
> I want to get namde of one employee, so I have entered the following command:
> select name from employee where id='1'; This returns zero rows.

Is there an employee with id='1'? What data type is the id column?
If it's a string type (char, varchar, text) then I wonder if the
data has extraneous whitespace. I mentioned this in my original
reply, and I asked you to run a query like the following:

SELECT '<' || id || '>', name FROM employee WHERE id LIKE '%1%';

Please run that query and look closely at whether there are spaces
around the id value. If the query doesn't return what you
expect,
then please post the query you ran and show the record you expect
it to match. It might be useful to see that record as the output
of the following command:

pg_dump -t employee -aD | grep 'something'

where 'something' is a pattern that will match the desired record.

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



Do you Yahoo!?

The all-new My Yahoo! – What will yours do?
--0-424084311-1106070865=:97372--
   

Copyright © 2006 knowledge-database   -   All rights reserved