Re: select statement fails - Mailing list pgsql-general

From Richard Huxton
Subject Re: select statement fails
Date
Msg-id 47FC9489.50204@archonet.com
Whole thread Raw
In response to select statement fails  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
Andrus Moor wrote:
> Richard,
>
>> 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.
>
> thank you.
> I have production database whose schema cannot changed easily.

ALTER TABLE...ALTER COLUMN...TYPE will do it within one statement. It
will require a lock on the table though.

> I is more reasonable to force npgsql driver to generate other code if no
> other solution.
> npgsql driver wants to add explicit casts to parameters.
> Is it reasonable to force driver to generate code
>
> select * from test where tc=' '::char(1);
>
> for char parameter type ?

I'd say so - I presume it just needs to be taught about different types
of text. Presumably it already knows that int8 is different from int4,
so it'll be doing something similar already. Check if there is a
mailing-list for the npgsql project and ask there - someone might
already be working on it.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Ashish Sharma"
Date:
Subject: SQL fast in PSQL, very slow using MS.NET driver
Next
From: "Peter Geoghegan"
Date:
Subject: Debugging Pl/PgSQL functions with the debug contrib module