Received: from mickey.anpe.fr (smtp1.anpe.fr [195.101.137.20]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0NDJP059523 for ; Tue, 23 Jan 2001 08:19:25 -0500 (EST) (envelope-from patrick.jacquot@anpe.fr) Received: from antivirus.anpe.fr ([10.0.4.95]) by mickey.anpe.fr (Netscape Messaging Server 4.05) with SMTP id G7MAFM00.U2A for ; Tue, 23 Jan 2001 14:21:22 +0100 Message-ID: <3A6DA16A.67018D22@anpe.fr> Date: Tue, 23 Jan 2001 16:21:15 +0100 From: patrick.jacquot@anpe.fr Organization: anpe X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.9-19mdk i586) X-Accept-Language: en MIME-Version: 1.0 To: Postgres SQL list Subject: Re: select returns no line References: <980253179.3a6d79fb29871@www.goodwill.hu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200101/288 X-Sequence-Number: 957 Attila Kevei wrote: > Hi, > > Our database has a SELECT problem using varchar columns in WHERE clause > (but not in all rows!!!). > We can fix the whole table (or just the row) as shown below but later it > seems wrong again (and after the fix the row isn't UPDATEd). > > Any idea? > > Thanks > Attila > > ******************************************************************************** > Environment: > > [PostgreSQL 6.5.3 on i686-pc-linux-gnu, compiled by gcc 2.95.2] > > goodwill=>\d users > Table = users > +----------------------------------+----------------------------------+-------+ > | Field | Type | Length| > +----------------------------------+----------------------------------+-------+ > | user_id | int4 not null default nextval ( | 4 | > | user_login | varchar() not null | 15 | > | user_passwd | varchar() not null | 15 | > | user_exp | timestamp | 4 | > +----------------------------------+----------------------------------+-------+ > Indices: users_pkey > > users_user_login_key > > ******************************************************************************** > The problem: > > goodwill=>select * from users where user_login='test'; > user_id|user_login|user_passwd|user_exp > -------+----------+-----------+-------- > (0 rows) > > goodwill=> select * from users where user_id=4; > user_id|user_login|user_passwd |user_exp > -------+----------+-------------+-------- > 4|test |0PDv7a2EESjZo| > (1 row) > > goodwill=> update users set user_login=user_login where user_id=4; > UPDATE > 1 > > goodwill=>select * from users where user_login='test'; > user_id|user_login|user_passwd |user_exp > -------+----------+-------------+-------- > 4|test |0PDv7a2EESjZo| > (1 row) > > -- > x- kisix@swi.hu -x- attila.kevei@goodwill.hu -x- kisiksz@westel900.net -x hello are you sure the value of the user_id in that line is "test" and not "test " i.e it has not spurious spaces at the end of it ? HTH Patrick