Re: Going crazy comparing bytea columns

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Going crazy comparing bytea columns
Дата
Msg-id 20060301211446.GA83071@winnie.fuhr.org
обсуждение исходный текст
Ответ на Going crazy comparing bytea columns  (scomp@canada.com)
Список pgsql-general
On Wed, Mar 01, 2006 at 10:40:39AM -0800, scomp@canada.com wrote:
> I am using npgsql with C# to insert a bytea value into a
> column which will serve as an encrypted password. This works
> well. However, when I retrieve the value, it is different.

Different how?  Without knowing more I'd wonder it's a matter of
escaped vs. non-escaped bytea values.

> In other words, "select pwd from table where pwd like @pwd"
> does not work.
>
> Is it not possible to compare bytea columns?

I can't help with npgsql but it's certainly possible to compare
bytea columns.  Incidentally, I don't know if this could be causing
any problems, but why are you using LIKE instead of "="?

> NpgsqlCommand cmd = new NpgsqlCommand("select pwd from table
> where usr = @usr and pwd like @pwd",dbConn);

What's the output of the following query?

SELECT pwd, @pwd FROM table WHERE usr = @usr

That should return the value in the database (pwd) and the value
you're providing (@pwd).  Let's see how they differ.

--
Michael Fuhr

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Going crazy comparing bytea columns
Следующее
От: "Greg Donald"
Дата:
Сообщение: Re: [OFFTOPIC] Typo3 + Postgresql anyone?