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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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

Browse pgsql-hackers by date

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

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-01-07 18:56:45 Re: [HACKERS] pgcryto strangeness...
Previous Message Sean Chittenden 2002-01-07 02:11:02 Re: pgcryto strangeness...