Thread: pgcrypto module for WINDOWS

pgcrypto module for WINDOWS

From
Mª José Sempere
Date:
Hello,


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'));

HOW CAN WE INSTALL THE PGCRYPTO MODULE FOR WINDOWS?
DO WE HAVE JUST TO INSTALL, OR DO WE NEED TO RECOMPILE SOMETHING?
In the first case (just install), what do we have to install and where do we
have to download it from?
In the second case (recompile), what and how do we have to recompile and
where do we have
to download it from?
We have found the library pgcrypto.dell in our hard disk, and also the files
pgcrypto.sql and pgcrypto.readme. We have
read the pgcrypto.readme, but we are made a mistake.

Who needs to know the digest() function, the server or the client?

Bye and thanks for your help.







Attachment

Re: pgcrypto module for WINDOWS

From
Joe Conway
Date:
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

Re: pgcrypto module for WINDOWS

From
"Magnus Hagander"
Date:
Hello,


    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'));

    HOW CAN WE INSTALL THE PGCRYPTO MODULE FOR WINDOWS?
    DO WE HAVE JUST TO INSTALL, OR DO WE NEED TO RECOMPILE SOMETHING?
    In the first case (just install), what do we have to install and where do we have to download it from?
    In the second case (recompile), what and how do we have to recompile and where do we have
    to download it from?
    We have found the library pgcrypto.dell in our hard disk, and also the files pgcrypto.sql and pgcrypto.readme. We
have
    read the pgcrypto.readme, but we are made a mistake.


Just run the commands in pgcrypto.sql through psql in the database you want to use pgcrypto from. This is done
automaticallyif you check the box for pgcrypto during installation, but can just as easily be done manually afterwards. 

//Magnus

Re: pgcrypto module for WINDOWS

From
Bruno Wolff III
Date:
On Fri, Dec 10, 2004 at 21:14:10 -0800,
  Joe Conway <mail@joeconway.com> wrote:
> 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?

They might be using M5 hashes as external names for the entries.