Re: pgcrypto module for WINDOWS - Mailing list pgsql-admin

From Joe Conway
Subject Re: pgcrypto module for WINDOWS
Date
Msg-id 41BA8222.8000409@joeconway.com
Whole thread Raw
In response to pgcrypto module for WINDOWS  (Mª José Sempere <mjose@pixelart.es>)
Responses Re: pgcrypto module for WINDOWS  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-admin
Mª José Sempere wrote:
> We are interested in installing the pgcrypto module of PostgreSQL for
>  Windows, In order to use the function digest() for creating index on
> bytea type fields:
>
> create unique index my_index on my_table (digest(my_bytea_field,
> 'md5'));


Um, why would you want to use digest() just so that you can index a
bytea field?

regression=# select version();
                           version
-----------------------------------------------------------------------
  PostgreSQL 7.4.5 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3
20040412 (Red Hat Linux 3.3.3-7)
(1 row)

regression=# create table foo(f1 bytea, f2 text);
CREATE TABLE
regression=# create unique index idx1 on foo(f1);
CREATE INDEX
regression=# insert into foo values('abc\\001\\002xyz');
INSERT 32018907 1
regression=# set enable_seqscan to off;
SET
regression=# explain analyze select * from foo where f1 =
'abc\\001\\002xyz';
                           QUERY PLAN
------------------------------------------------------------------------
  Index Scan using idx1 on foo  (cost=0.00..4.82 rows=2 width=64)
(actual time=0.026..0.030 rows=1 loops=1)
    Index Cond: (f1 = 'abc\\001\\002xyz'::bytea)
  Total runtime: 0.114 ms
(3 rows)


HTH,

Joe

pgsql-admin by date:

Previous
From: Mª José Sempere
Date:
Subject: pgcrypto module for WINDOWS
Next
From: Ron Peterson
Date:
Subject: Re: fallback authentication