Re: select statement fails

From: Richard Huxton <dev(at)archonet(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select statement fails
Date: 2008-04-09 08:58:51
Message-ID: 47FC854B.1080106@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrus wrote:
> Any idea why the following select statement does not return rows ?
> This select statement is generated by npgsql2 beta 3 so I cannot change it
> in my application.
> How to fix without changing select statement ?
>
> Andrus.
>
> create temp table test ( tc char(1) );
> insert into test values(' ');
> select * from test where tc=' '::text;

It doesn't return rows because you're using a space-padded type (char)
to try and store a space.

I think you probably want varchar(1) instead.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Hunter 2008-04-09 09:00:08 Re: Trouble with foreign key
Previous Message Martijn van Oosterhout 2008-04-09 08:39:06 Re: wrong query result