mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
5484c0a980
Extension scripts should never use CREATE OR REPLACE for initial object creation. If there is a collision with a pre-existing (probably user-created) object, we want extension installation to fail, not silently overwrite the user's object. Bloom and sslinfo both violated this precept. Also fix a number of scripts that had no standard header (the file name comment and the \echo...\quit guard). Probably the \echo...\quit hack is less important now than it was in 9.1 days, but that doesn't mean that individual extensions get to choose whether to use it or not. And fix a couple of evident copy-and-pasteos in file name comments. No need for back-patch: the REPLACE bugs are both new in 9.6, and the rest of this is pretty much cosmetic. Andreas Karlsson and Tom Lane
218 lines
5.6 KiB
SQL
218 lines
5.6 KiB
SQL
/* contrib/pgcrypto/pgcrypto--1.3.sql */
|
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
\echo Use "CREATE EXTENSION pgcrypto" to load this file. \quit
|
|
|
|
CREATE FUNCTION digest(text, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_digest'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION digest(bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_digest'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION hmac(text, text, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_hmac'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION hmac(bytea, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_hmac'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION crypt(text, text)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pg_crypt'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION gen_salt(text)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pg_gen_salt'
|
|
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION gen_salt(text, int4)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pg_gen_salt_rounds'
|
|
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION encrypt(bytea, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_encrypt'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION decrypt(bytea, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_decrypt'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION encrypt_iv(bytea, bytea, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_encrypt_iv'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION decrypt_iv(bytea, bytea, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_decrypt_iv'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION gen_random_bytes(int4)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_random_bytes'
|
|
LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION gen_random_uuid()
|
|
RETURNS uuid
|
|
AS 'MODULE_PATHNAME', 'pg_random_uuid'
|
|
LANGUAGE C VOLATILE PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_sym_encrypt(data, key)
|
|
--
|
|
CREATE FUNCTION pgp_sym_encrypt(text, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_encrypt_text'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_sym_encrypt_bytea(bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_encrypt_bytea'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_sym_encrypt(data, key, args)
|
|
--
|
|
CREATE FUNCTION pgp_sym_encrypt(text, text, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_encrypt_text'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_sym_encrypt_bytea(bytea, text, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_encrypt_bytea'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_sym_decrypt(data, key)
|
|
--
|
|
CREATE FUNCTION pgp_sym_decrypt(bytea, text)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_decrypt_text'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_sym_decrypt_bytea(bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_decrypt_bytea'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_sym_decrypt(data, key, args)
|
|
--
|
|
CREATE FUNCTION pgp_sym_decrypt(bytea, text, text)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_decrypt_text'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_sym_decrypt_bytea(bytea, text, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_sym_decrypt_bytea'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_pub_encrypt(data, key)
|
|
--
|
|
CREATE FUNCTION pgp_pub_encrypt(text, bytea)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_encrypt_text'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_pub_encrypt_bytea(bytea, bytea)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_encrypt_bytea'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_pub_encrypt(data, key, args)
|
|
--
|
|
CREATE FUNCTION pgp_pub_encrypt(text, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_encrypt_text'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_pub_encrypt_bytea(bytea, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_encrypt_bytea'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_pub_decrypt(data, key)
|
|
--
|
|
CREATE FUNCTION pgp_pub_decrypt(bytea, bytea)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_decrypt_text'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_pub_decrypt_bytea(bytea, bytea)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_decrypt_bytea'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_pub_decrypt(data, key, psw)
|
|
--
|
|
CREATE FUNCTION pgp_pub_decrypt(bytea, bytea, text)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_decrypt_text'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_decrypt_bytea'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp_pub_decrypt(data, key, psw, arg)
|
|
--
|
|
CREATE FUNCTION pgp_pub_decrypt(bytea, bytea, text, text)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_decrypt_text'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text, text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pgp_pub_decrypt_bytea'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- PGP key ID
|
|
--
|
|
CREATE FUNCTION pgp_key_id(bytea)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pgp_key_id_w'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
--
|
|
-- pgp armor
|
|
--
|
|
CREATE FUNCTION armor(bytea)
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pg_armor'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION armor(bytea, text[], text[])
|
|
RETURNS text
|
|
AS 'MODULE_PATHNAME', 'pg_armor'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION dearmor(text)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'pg_dearmor'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
CREATE FUNCTION pgp_armor_headers(text, key OUT text, value OUT text)
|
|
RETURNS SETOF record
|
|
AS 'MODULE_PATHNAME', 'pgp_armor_headers'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|