Going crazy comparing bytea columns - Mailing list pgsql-general

From scomp@canada.com
Subject Going crazy comparing bytea columns
Date
Msg-id 4405eaa7.238.999.19861@canada.com
Whole thread Raw
Responses Re: Going crazy comparing bytea columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Going crazy comparing bytea columns  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Hi,
I am new to Postgresql, so pls be patient.

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.
In other words, "select pwd from table where pwd like @pwd"
does not work.

Is it not possible to compare bytea columns?

...get dbConn...

NpgsqlCommand cmd = new NpgsqlCommand("select pwd from table
where usr = @usr and pwd like @pwd",dbConn);
cmd.Parameters.Add(new NpgsqlParameter("usr",DbType.String);
cmd.Parameters.Add(new
NpgsqlParameter("pwd",NpgsqlTypes.NpgsqlDbType.Bytea);
cmd.prepare()
... set param values, call executereader...

Thanks,

JM


----------------------------------------
Upgrade your account today for increased storage; mail
forwarding or POP enabled e-mail with automatic virus
scanning. Visit our member benefits page at
https://members.canada.com/benefits.aspx for more
information.

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Special offer with a possible dontation to the
Next
From: Tino Wildenhain
Date:
Subject: Re: a web framework for postgresql?