Re: [HACKERS] pgcryto strangeness...

Поиск
Список
Период
Сортировка
Искать

Re: [HACKERS] pgcryto strangeness...

От:
Marko Kreen <marko@l-t.ee>
Дата:
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',

Re: [HACKERS] pgcryto strangeness...

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Marko Kreen  writes:
> 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.

Done.

			regards, tom lane
FAQ