Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] pgcryto strangeness...

From: Marko Kreen <marko(at)l-t(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sean Chittenden <sean(at)chittenden(dot)org>, Joe Conway <joseph(dot)conway(at)home(dot)com>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] pgcryto strangeness...
Date: 2002-01-07 05:34:50
Message-ID: 20020107053450.GB8497@l-t.ee (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On Sat, Jan 05, 2002 at 04:39:31PM -0500, Tom Lane wrote:
> You could add
> 
> CREATE FUNCTION digest(text, text) RETURNS bytea
>   AS 'MODULE_PATHNAME',
>   'pg_digest' LANGUAGE 'C';
> 
> which should work fine since the internal representation of text isn't
> really different from that of bytea.

This is so obvious that I would like to make it 'official'.

Seems like the theology around bytea<>text casting kept me from
seeing the simple :)

As this should go under 'polishing' I hope it gets into 7.2.

-- 
marko



Index: contrib/pgcrypto/pgcrypto.sql.in
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/pgcrypto.sql.in,v
retrieving revision 1.6
diff -u -r1.6 pgcrypto.sql.in
--- contrib/pgcrypto/pgcrypto.sql.in	29 Sep 2001 03:11:58 -0000	1.6
+++ contrib/pgcrypto/pgcrypto.sql.in	7 Jan 2002 04:11:00 -0000
@@ -1,6 +1,8 @@
 
+-- drop function digest(text, text);
 -- drop function digest(bytea, text);
 -- drop function digest_exists(text);
+-- drop function hmac(text, text, text);
 -- drop function hmac(bytea, bytea, text);
 -- drop function hmac_exists(text);
 -- drop function crypt(text, text);
@@ -14,6 +16,10 @@
 
 
 
+CREATE FUNCTION digest(text, text) RETURNS bytea
+  AS 'MODULE_PATHNAME',
+  'pg_digest' LANGUAGE 'C';
+
 CREATE FUNCTION digest(bytea, text) RETURNS bytea
   AS 'MODULE_PATHNAME',
   'pg_digest' LANGUAGE 'C';
@@ -21,6 +27,10 @@
 CREATE FUNCTION digest_exists(text) RETURNS bool
   AS 'MODULE_PATHNAME',
   'pg_digest_exists' LANGUAGE 'C';
+
+CREATE FUNCTION hmac(text, text, text) RETURNS bytea
+  AS 'MODULE_PATHNAME',
+  'pg_hmac' LANGUAGE 'C';
 
 CREATE FUNCTION hmac(bytea, bytea, text) RETURNS bytea
   AS 'MODULE_PATHNAME',

In response to

Responses

pgsql-hackers by date

Next:From: Hannu KrosingDate: 2002-01-07 07:01:15
Subject: Re: LWLock contention: I think I understand the problem
Previous:From: Tatsuo IshiiDate: 2002-01-07 05:27:43
Subject: ecpg compile error on AIX

pgsql-patches by date

Next:From: Tom LaneDate: 2002-01-07 18:56:45
Subject: Re: [HACKERS] pgcryto strangeness...
Previous:From: Sean ChittendenDate: 2002-01-07 02:11:02
Subject: Re: pgcryto strangeness...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group