summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto
diff options
context:
space:
mode:
authorBruce Momjian2002-10-18 18:41:22 +0000
committerBruce Momjian2002-10-18 18:41:22 +0000
commitaa4c702eac936964649f905741b4a99f4b489200 (patch)
tree517d3c28aa3d28eb95b19c8676c940b5cefe2031 /contrib/pgcrypto
parentfb9bc342fffc157d6ca4b635aeeaccb3c1370b91 (diff)
Update /contrib for "autocommit TO 'on'".
Create objects in public schema. Make spacing/capitalization consistent. Remove transaction block use for object creation. Remove unneeded function GRANTs.
Diffstat (limited to 'contrib/pgcrypto')
-rw-r--r--contrib/pgcrypto/expected/blowfish.out23
-rw-r--r--contrib/pgcrypto/expected/crypt-blowfish.out18
-rw-r--r--contrib/pgcrypto/expected/crypt-des.out18
-rw-r--r--contrib/pgcrypto/expected/crypt-md5.out18
-rw-r--r--contrib/pgcrypto/expected/crypt-xdes.out18
-rw-r--r--contrib/pgcrypto/expected/hmac-md5.out15
-rw-r--r--contrib/pgcrypto/expected/hmac-sha1.out15
-rw-r--r--contrib/pgcrypto/expected/init.out4
-rw-r--r--contrib/pgcrypto/expected/md5.out15
-rw-r--r--contrib/pgcrypto/expected/rijndael.out15
-rw-r--r--contrib/pgcrypto/expected/sha1.out15
-rw-r--r--contrib/pgcrypto/pgcrypto.sql.in147
-rw-r--r--contrib/pgcrypto/sql/blowfish.sql24
-rw-r--r--contrib/pgcrypto/sql/crypt-blowfish.sql19
-rw-r--r--contrib/pgcrypto/sql/crypt-des.sql19
-rw-r--r--contrib/pgcrypto/sql/crypt-md5.sql19
-rw-r--r--contrib/pgcrypto/sql/crypt-xdes.sql19
-rw-r--r--contrib/pgcrypto/sql/hmac-md5.sql16
-rw-r--r--contrib/pgcrypto/sql/hmac-sha1.sql16
-rw-r--r--contrib/pgcrypto/sql/init.sql5
-rw-r--r--contrib/pgcrypto/sql/md5.sql16
-rw-r--r--contrib/pgcrypto/sql/rijndael.sql16
-rw-r--r--contrib/pgcrypto/sql/sha1.sql16
23 files changed, 273 insertions, 233 deletions
diff --git a/contrib/pgcrypto/expected/blowfish.out b/contrib/pgcrypto/expected/blowfish.out
index e7fd632df2..1f2ccd82b4 100644
--- a/contrib/pgcrypto/expected/blowfish.out
+++ b/contrib/pgcrypto/expected/blowfish.out
@@ -1,8 +1,9 @@
--
-- Blowfish cipher
--
+SET autocommit TO 'on';
-- some standard Blowfish testvalues
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0000000000000000', 'hex'),
decode('0000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -11,7 +12,7 @@ decode('0000000000000000', 'hex'),
4ef997456198dd78
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('ffffffffffffffff', 'hex'),
decode('ffffffffffffffff', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -20,7 +21,7 @@ decode('ffffffffffffffff', 'hex'),
51866fd5b85ecb8a
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('1000000000000001', 'hex'),
decode('3000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -29,7 +30,7 @@ decode('3000000000000000', 'hex'),
7d856f9a613063f2
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('1111111111111111', 'hex'),
decode('1111111111111111', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -38,7 +39,7 @@ decode('1111111111111111', 'hex'),
2466dd878b963c9d
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0123456789abcdef', 'hex'),
decode('fedcba9876543210', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -47,7 +48,7 @@ decode('fedcba9876543210', 'hex'),
0aceab0fc6a0a28d
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('01a1d6d039776742', 'hex'),
decode('fedcba9876543210', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -56,7 +57,7 @@ decode('fedcba9876543210', 'hex'),
3273b8badc9e9e15
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('ffffffffffffffff', 'hex'),
decode('0000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -66,7 +67,7 @@ decode('0000000000000000', 'hex'),
(1 row)
-- setkey
-select encode(encrypt(
+SELECT encode(encrypt(
decode('fedcba9876543210', 'hex'),
decode('f0e1d2c3b4a5968778695a4b3c2d1e0f', 'hex'),
'bf-ecb/pad:none'), 'hex');
@@ -76,7 +77,7 @@ decode('f0e1d2c3b4a5968778695a4b3c2d1e0f', 'hex'),
(1 row)
-- with padding
-select encode(encrypt(
+SELECT encode(encrypt(
decode('01234567890123456789', 'hex'),
decode('33443344334433443344334433443344', 'hex'),
'bf-ecb'), 'hex');
@@ -87,7 +88,7 @@ decode('33443344334433443344334433443344', 'hex'),
-- cbc
-- 28 bytes key
-select encode(encrypt(
+SELECT encode(encrypt(
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5', 'hex'),
decode('37363534333231204e6f77206973207468652074696d6520666f7220', 'hex'),
'bf-cbc'), 'hex');
@@ -97,7 +98,7 @@ decode('37363534333231204e6f77206973207468652074696d6520666f7220', 'hex'),
(1 row)
-- 29 bytes key
-select encode(encrypt(
+SELECT encode(encrypt(
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc', 'hex'),
decode('37363534333231204e6f77206973207468652074696d6520666f722000', 'hex'),
'bf-cbc'), 'hex');
diff --git a/contrib/pgcrypto/expected/crypt-blowfish.out b/contrib/pgcrypto/expected/crypt-blowfish.out
index 7910a4e02e..9b92974931 100644
--- a/contrib/pgcrypto/expected/crypt-blowfish.out
+++ b/contrib/pgcrypto/expected/crypt-blowfish.out
@@ -1,26 +1,28 @@
--
-- crypt() and gen_salt(): bcrypt
--
-select crypt('', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
+SET autocommit TO 'on';
+SELECT crypt('', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
crypt
--------------------------------------------------------------
$2a$06$RQiOJ.3ELirrXwxIZY8q0OlGbBEpDmx7IRZlNYvGJ1SHXwNi2cEKK
(1 row)
-select crypt('foox', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
+SELECT crypt('foox', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
crypt
--------------------------------------------------------------
$2a$06$RQiOJ.3ELirrXwxIZY8q0OR3CVJrAfda1z26CCHPnB6mmVZD8p0/C
(1 row)
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
-update ctest set salt = gen_salt('bf', 8);
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
+UPDATE ctest SET salt = gen_salt('bf', 8);
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
worked
--------
t
(1 row)
-drop table ctest;
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/expected/crypt-des.out b/contrib/pgcrypto/expected/crypt-des.out
index 76a756eada..574a45bae7 100644
--- a/contrib/pgcrypto/expected/crypt-des.out
+++ b/contrib/pgcrypto/expected/crypt-des.out
@@ -1,26 +1,28 @@
--
-- crypt() and gen_salt(): crypt-des
--
-select crypt('', 'NB');
+SET autocommit TO 'on';
+SELECT crypt('', 'NB');
crypt
---------------
NBPx/38Y48kHg
(1 row)
-select crypt('foox', 'NB');
+SELECT crypt('foox', 'NB');
crypt
---------------
NB53EGGqrrb5E
(1 row)
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
-update ctest set salt = gen_salt('des');
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
+UPDATE ctest SET salt = gen_salt('des');
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
worked
--------
t
(1 row)
-drop table ctest;
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/expected/crypt-md5.out b/contrib/pgcrypto/expected/crypt-md5.out
index 4bd2f33a9f..545236d654 100644
--- a/contrib/pgcrypto/expected/crypt-md5.out
+++ b/contrib/pgcrypto/expected/crypt-md5.out
@@ -1,26 +1,28 @@
--
-- crypt() and gen_salt(): md5
--
-select crypt('', '$1$Szzz0yzz');
+SET autocommit TO 'on';
+SELECT crypt('', '$1$Szzz0yzz');
crypt
------------------------------------
$1$Szzz0yzz$To38XrR3BsbXQW2ZpfKjF1
(1 row)
-select crypt('foox', '$1$Szzz0yzz');
+SELECT crypt('foox', '$1$Szzz0yzz');
crypt
------------------------------------
$1$Szzz0yzz$IYL49cd3t9bllsA7Jmz1M1
(1 row)
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
-update ctest set salt = gen_salt('md5');
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
+UPDATE ctest SET salt = gen_salt('md5');
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
worked
--------
t
(1 row)
-drop table ctest;
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/expected/crypt-xdes.out b/contrib/pgcrypto/expected/crypt-xdes.out
index d247b552b2..b2593fc16b 100644
--- a/contrib/pgcrypto/expected/crypt-xdes.out
+++ b/contrib/pgcrypto/expected/crypt-xdes.out
@@ -1,26 +1,28 @@
--
-- crypt() and gen_salt(): extended des
--
-select crypt('', '_J9..j2zz');
+SET autocommit TO 'on';
+SELECT crypt('', '_J9..j2zz');
crypt
----------------------
_J9..j2zzR/nIRDK3pPc
(1 row)
-select crypt('foox', '_J9..j2zz');
+SELECT crypt('foox', '_J9..j2zz');
crypt
----------------------
_J9..j2zzAYKMvO2BYRY
(1 row)
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
-update ctest set salt = gen_salt('xdes', 1001);
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
+UPDATE ctest SET salt = gen_salt('xdes', 1001);
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
worked
--------
t
(1 row)
-drop table ctest;
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/expected/hmac-md5.out b/contrib/pgcrypto/expected/hmac-md5.out
index 5cd55ce440..dedd5afe71 100644
--- a/contrib/pgcrypto/expected/hmac-md5.out
+++ b/contrib/pgcrypto/expected/hmac-md5.out
@@ -1,7 +1,8 @@
--
-- HMAC-MD5
--
-select encode(hmac(
+SET autocommit TO 'on';
+SELECT encode(hmac(
'Hi There',
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
'md5'), 'hex');
@@ -11,7 +12,7 @@ decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
(1 row)
-- 2
-select encode(hmac(
+SELECT encode(hmac(
'Jefe',
'what do ya want for nothing?',
'md5'), 'hex');
@@ -21,7 +22,7 @@ select encode(hmac(
(1 row)
-- 3
-select encode(hmac(
+SELECT encode(hmac(
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
@@ -31,7 +32,7 @@ decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
(1 row)
-- 4
-select encode(hmac(
+SELECT encode(hmac(
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
'md5'), 'hex');
@@ -41,7 +42,7 @@ decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
(1 row)
-- 5
-select encode(hmac(
+SELECT encode(hmac(
'Test With Truncation',
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
'md5'), 'hex');
@@ -51,7 +52,7 @@ decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
(1 row)
-- 6
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key - Hash Key First',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
@@ -61,7 +62,7 @@ decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(1 row)
-- 7
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
diff --git a/contrib/pgcrypto/expected/hmac-sha1.out b/contrib/pgcrypto/expected/hmac-sha1.out
index e4739fe5f3..4ccb0f101b 100644
--- a/contrib/pgcrypto/expected/hmac-sha1.out
+++ b/contrib/pgcrypto/expected/hmac-sha1.out
@@ -1,7 +1,8 @@
--
-- HMAC-MD5
--
-select encode(hmac(
+SET autocommit TO 'on';
+SELECT encode(hmac(
'Hi There',
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
'sha1'), 'hex');
@@ -11,7 +12,7 @@ decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
(1 row)
-- 2
-select encode(hmac(
+SELECT encode(hmac(
'Jefe',
'what do ya want for nothing?',
'sha1'), 'hex');
@@ -21,7 +22,7 @@ select encode(hmac(
(1 row)
-- 3
-select encode(hmac(
+SELECT encode(hmac(
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
@@ -31,7 +32,7 @@ decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
(1 row)
-- 4
-select encode(hmac(
+SELECT encode(hmac(
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
'sha1'), 'hex');
@@ -41,7 +42,7 @@ decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
(1 row)
-- 5
-select encode(hmac(
+SELECT encode(hmac(
'Test With Truncation',
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
'sha1'), 'hex');
@@ -51,7 +52,7 @@ decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
(1 row)
-- 6
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key - Hash Key First',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
@@ -61,7 +62,7 @@ decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(1 row)
-- 7
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
diff --git a/contrib/pgcrypto/expected/init.out b/contrib/pgcrypto/expected/init.out
index a7c95eb63c..509f454047 100644
--- a/contrib/pgcrypto/expected/init.out
+++ b/contrib/pgcrypto/expected/init.out
@@ -3,13 +3,13 @@
--
\set ECHO none
-- check for encoding fn's
-select encode('foo', 'hex');
+SELECT encode('foo', 'hex');
encode
--------
666f6f
(1 row)
-select decode('666f6f', 'hex');
+SELECT decode('666f6f', 'hex');
decode
--------
foo
diff --git a/contrib/pgcrypto/expected/md5.out b/contrib/pgcrypto/expected/md5.out
index ec8368042e..70933c9a73 100644
--- a/contrib/pgcrypto/expected/md5.out
+++ b/contrib/pgcrypto/expected/md5.out
@@ -1,43 +1,44 @@
--
-- MD5 message digest
--
-select encode(digest('', 'md5'), 'hex');
+SET autocommit TO 'on';
+SELECT encode(digest('', 'md5'), 'hex');
encode
----------------------------------
d41d8cd98f00b204e9800998ecf8427e
(1 row)
-select encode(digest('a', 'md5'), 'hex');
+SELECT encode(digest('a', 'md5'), 'hex');
encode
----------------------------------
0cc175b9c0f1b6a831c399e269772661
(1 row)
-select encode(digest('abc', 'md5'), 'hex');
+SELECT encode(digest('abc', 'md5'), 'hex');
encode
----------------------------------
900150983cd24fb0d6963f7d28e17f72
(1 row)
-select encode(digest('message digest', 'md5'), 'hex');
+SELECT encode(digest('message digest', 'md5'), 'hex');
encode
----------------------------------
f96b697d7cb7938d525a2f31aaf161d0
(1 row)
-select encode(digest('abcdefghijklmnopqrstuvwxyz', 'md5'), 'hex');
+SELECT encode(digest('abcdefghijklmnopqrstuvwxyz', 'md5'), 'hex');
encode
----------------------------------
c3fcd3d76192e4007dfb496cca67e13b
(1 row)
-select encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5'), 'hex');
+SELECT encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5'), 'hex');
encode
----------------------------------
d174ab98d277d9f5a5611c2c9f419d9f
(1 row)
-select encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5'), 'hex');
+SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5'), 'hex');
encode
----------------------------------
57edf4a22be3c955ac49da2e2107b67a
diff --git a/contrib/pgcrypto/expected/rijndael.out b/contrib/pgcrypto/expected/rijndael.out
index 2f64268944..18ade2025b 100644
--- a/contrib/pgcrypto/expected/rijndael.out
+++ b/contrib/pgcrypto/expected/rijndael.out
@@ -1,8 +1,9 @@
--
-- AES / Rijndael-128 cipher
--
+SET autocommit TO 'on';
-- some standard Rijndael testvalues
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f', 'hex'),
'aes-ecb/pad:none'), 'hex');
@@ -11,7 +12,7 @@ decode('000102030405060708090a0b0c0d0e0f', 'hex'),
69c4e0d86a7b0430d8cdb78070b4c55a
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f1011121314151617', 'hex'),
'aes-ecb/pad:none'), 'hex');
@@ -20,7 +21,7 @@ decode('000102030405060708090a0b0c0d0e0f1011121314151617', 'hex'),
dda97ca4864cdfe06eaf70a0ec0d7191
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
'aes-ecb/pad:none'), 'hex');
@@ -30,7 +31,7 @@ decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'
(1 row)
-- cbc
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
'aes-cbc/pad:none'), 'hex');
@@ -40,7 +41,7 @@ decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'
(1 row)
-- key padding
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405', 'hex'),
'aes-cbc'), 'hex');
@@ -49,7 +50,7 @@ decode('000102030405', 'hex'),
189a28932213f017b246678dbc28655f
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405060708090a0b0c0d0e0f10111213', 'hex'),
'aes-cbc'), 'hex');
@@ -58,7 +59,7 @@ decode('000102030405060708090a0b0c0d0e0f10111213', 'hex'),
3b02279162d15580e069d3a71407a556
(1 row)
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b', 'hex'),
'aes-cbc'), 'hex');
diff --git a/contrib/pgcrypto/expected/sha1.out b/contrib/pgcrypto/expected/sha1.out
index 430c881a9f..af86171d88 100644
--- a/contrib/pgcrypto/expected/sha1.out
+++ b/contrib/pgcrypto/expected/sha1.out
@@ -1,43 +1,44 @@
--
-- SHA1 message digest
--
-select encode(digest('', 'sha1'), 'hex');
+SET autocommit TO 'on';
+SELECT encode(digest('', 'sha1'), 'hex');
encode
------------------------------------------
da39a3ee5e6b4b0d3255bfef95601890afd80709
(1 row)
-select encode(digest('a', 'sha1'), 'hex');
+SELECT encode(digest('a', 'sha1'), 'hex');
encode
------------------------------------------
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
(1 row)
-select encode(digest('abc', 'sha1'), 'hex');
+SELECT encode(digest('abc', 'sha1'), 'hex');
encode
------------------------------------------
a9993e364706816aba3e25717850c26c9cd0d89d
(1 row)
-select encode(digest('message digest', 'sha1'), 'hex');
+SELECT encode(digest('message digest', 'sha1'), 'hex');
encode
------------------------------------------
c12252ceda8be8994d5fa0290a47231c1d16aae3
(1 row)
-select encode(digest('abcdefghijklmnopqrstuvwxyz', 'sha1'), 'hex');
+SELECT encode(digest('abcdefghijklmnopqrstuvwxyz', 'sha1'), 'hex');
encode
------------------------------------------
32d10c7b8cf96570ca04ce37f2a19d84240d3a89
(1 row)
-select encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'sha1'), 'hex');
+SELECT encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'sha1'), 'hex');
encode
------------------------------------------
761c457bf73b14d27e9e9265c46f4b4dda11f940
(1 row)
-select encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha1'), 'hex');
+SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha1'), 'hex');
encode
------------------------------------------
50abf5706a150990a08b2c5ea40fa0e585554732
diff --git a/contrib/pgcrypto/pgcrypto.sql.in b/contrib/pgcrypto/pgcrypto.sql.in
index 3efb2ed969..0f3cbe537a 100644
--- a/contrib/pgcrypto/pgcrypto.sql.in
+++ b/contrib/pgcrypto/pgcrypto.sql.in
@@ -1,75 +1,76 @@
-
--- 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);
--- drop function gen_salt(text);
--- drop function gen_salt(text, int4);
--- drop function encrypt(bytea, bytea, text);
--- drop function decrypt(bytea, bytea, text);
--- drop function encrypt_iv(bytea, bytea, bytea, text);
--- drop function decrypt_iv(bytea, bytea, bytea, text);
--- drop function cipher_exists(text);
-
-
-
-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';
-
-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',
- 'pg_hmac' LANGUAGE 'C';
-
-CREATE FUNCTION hmac_exists(text) RETURNS bool
- AS 'MODULE_PATHNAME',
- 'pg_hmac_exists' LANGUAGE 'C';
-
-CREATE FUNCTION crypt(text, text) RETURNS text
- AS 'MODULE_PATHNAME',
- 'pg_crypt' LANGUAGE 'C';
-
-CREATE FUNCTION gen_salt(text) RETURNS text
- AS 'MODULE_PATHNAME',
- 'pg_gen_salt' LANGUAGE 'C';
-
-CREATE FUNCTION gen_salt(text, int4) RETURNS text
- AS 'MODULE_PATHNAME',
- 'pg_gen_salt_rounds' LANGUAGE 'C';
-
-CREATE FUNCTION encrypt(bytea, bytea, text) RETURNS bytea
- AS 'MODULE_PATHNAME',
- 'pg_encrypt' LANGUAGE 'C';
-
-CREATE FUNCTION decrypt(bytea, bytea, text) RETURNS bytea
- AS 'MODULE_PATHNAME',
- 'pg_decrypt' LANGUAGE 'C';
-
-CREATE FUNCTION encrypt_iv(bytea, bytea, bytea, text) RETURNS bytea
- AS 'MODULE_PATHNAME',
- 'pg_encrypt_iv' LANGUAGE 'C';
-
-CREATE FUNCTION decrypt_iv(bytea, bytea, bytea, text) RETURNS bytea
- AS 'MODULE_PATHNAME',
- 'pg_decrypt_iv' LANGUAGE 'C';
-
-CREATE FUNCTION cipher_exists(text) RETURNS bool
- AS 'MODULE_PATHNAME',
- 'pg_cipher_exists' LANGUAGE 'C';
+-- Adjust this setting to control where the objects get created.
+SET search_path = public;
+
+SET autocommit TO 'on';
+
+CREATE OR REPLACE FUNCTION digest(text, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_digest'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION digest(bytea, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_digest'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION digest_exists(text)
+RETURNS bool
+AS 'MODULE_PATHNAME', 'pg_digest_exists'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION hmac(text, text, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_hmac'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION hmac(bytea, bytea, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_hmac'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION hmac_exists(text)
+RETURNS bool
+AS 'MODULE_PATHNAME', 'pg_hmac_exists'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION crypt(text, text)
+RETURNS text
+AS 'MODULE_PATHNAME', 'pg_crypt'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION gen_salt(text)
+RETURNS text
+AS 'MODULE_PATHNAME', 'pg_gen_salt'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION gen_salt(text, int4)
+RETURNS text
+AS 'MODULE_PATHNAME', 'pg_gen_salt_rounds'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION encrypt(bytea, bytea, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_encrypt'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION decrypt(bytea, bytea, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_decrypt'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION encrypt_iv(bytea, bytea, bytea, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_encrypt_iv'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION decrypt_iv(bytea, bytea, bytea, text)
+RETURNS bytea
+AS 'MODULE_PATHNAME', 'pg_decrypt_iv'
+LANGUAGE 'C';
+
+CREATE OR REPLACE FUNCTION cipher_exists(text)
+RETURNS bool
+AS 'MODULE_PATHNAME', 'pg_cipher_exists'
+LANGUAGE 'C';
diff --git a/contrib/pgcrypto/sql/blowfish.sql b/contrib/pgcrypto/sql/blowfish.sql
index e1fa7b1f49..93187dcba3 100644
--- a/contrib/pgcrypto/sql/blowfish.sql
+++ b/contrib/pgcrypto/sql/blowfish.sql
@@ -2,50 +2,52 @@
-- Blowfish cipher
--
+SET autocommit TO 'on';
+
-- some standard Blowfish testvalues
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0000000000000000', 'hex'),
decode('0000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('ffffffffffffffff', 'hex'),
decode('ffffffffffffffff', 'hex'),
'bf-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('1000000000000001', 'hex'),
decode('3000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('1111111111111111', 'hex'),
decode('1111111111111111', 'hex'),
'bf-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0123456789abcdef', 'hex'),
decode('fedcba9876543210', 'hex'),
'bf-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('01a1d6d039776742', 'hex'),
decode('fedcba9876543210', 'hex'),
'bf-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('ffffffffffffffff', 'hex'),
decode('0000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
-- setkey
-select encode(encrypt(
+SELECT encode(encrypt(
decode('fedcba9876543210', 'hex'),
decode('f0e1d2c3b4a5968778695a4b3c2d1e0f', 'hex'),
'bf-ecb/pad:none'), 'hex');
-- with padding
-select encode(encrypt(
+SELECT encode(encrypt(
decode('01234567890123456789', 'hex'),
decode('33443344334433443344334433443344', 'hex'),
'bf-ecb'), 'hex');
@@ -53,13 +55,13 @@ decode('33443344334433443344334433443344', 'hex'),
-- cbc
-- 28 bytes key
-select encode(encrypt(
+SELECT encode(encrypt(
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5', 'hex'),
decode('37363534333231204e6f77206973207468652074696d6520666f7220', 'hex'),
'bf-cbc'), 'hex');
-- 29 bytes key
-select encode(encrypt(
+SELECT encode(encrypt(
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc', 'hex'),
decode('37363534333231204e6f77206973207468652074696d6520666f722000', 'hex'),
'bf-cbc'), 'hex');
diff --git a/contrib/pgcrypto/sql/crypt-blowfish.sql b/contrib/pgcrypto/sql/crypt-blowfish.sql
index 6b82fdff63..5128675e0c 100644
--- a/contrib/pgcrypto/sql/crypt-blowfish.sql
+++ b/contrib/pgcrypto/sql/crypt-blowfish.sql
@@ -2,16 +2,19 @@
-- crypt() and gen_salt(): bcrypt
--
-select crypt('', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
+SET autocommit TO 'on';
-select crypt('foox', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
+SELECT crypt('', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
+SELECT crypt('foox', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
-update ctest set salt = gen_salt('bf', 8);
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
-drop table ctest;
+UPDATE ctest SET salt = gen_salt('bf', 8);
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
+
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/sql/crypt-des.sql b/contrib/pgcrypto/sql/crypt-des.sql
index 2a2fbfb36c..ff43112dd8 100644
--- a/contrib/pgcrypto/sql/crypt-des.sql
+++ b/contrib/pgcrypto/sql/crypt-des.sql
@@ -2,16 +2,19 @@
-- crypt() and gen_salt(): crypt-des
--
-select crypt('', 'NB');
+SET autocommit TO 'on';
-select crypt('foox', 'NB');
+SELECT crypt('', 'NB');
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
+SELECT crypt('foox', 'NB');
-update ctest set salt = gen_salt('des');
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
-drop table ctest;
+UPDATE ctest SET salt = gen_salt('des');
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
+
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/sql/crypt-md5.sql b/contrib/pgcrypto/sql/crypt-md5.sql
index 8ef8dbae0f..c570e4ab7a 100644
--- a/contrib/pgcrypto/sql/crypt-md5.sql
+++ b/contrib/pgcrypto/sql/crypt-md5.sql
@@ -2,16 +2,19 @@
-- crypt() and gen_salt(): md5
--
-select crypt('', '$1$Szzz0yzz');
+SET autocommit TO 'on';
-select crypt('foox', '$1$Szzz0yzz');
+SELECT crypt('', '$1$Szzz0yzz');
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
+SELECT crypt('foox', '$1$Szzz0yzz');
-update ctest set salt = gen_salt('md5');
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
-drop table ctest;
+UPDATE ctest SET salt = gen_salt('md5');
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
+
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/sql/crypt-xdes.sql b/contrib/pgcrypto/sql/crypt-xdes.sql
index 6fd85b929a..c6205ab600 100644
--- a/contrib/pgcrypto/sql/crypt-xdes.sql
+++ b/contrib/pgcrypto/sql/crypt-xdes.sql
@@ -2,16 +2,19 @@
-- crypt() and gen_salt(): extended des
--
-select crypt('', '_J9..j2zz');
+SET autocommit TO 'on';
-select crypt('foox', '_J9..j2zz');
+SELECT crypt('', '_J9..j2zz');
-create table ctest (data text, res text, salt text);
-insert into ctest values ('password', '', '');
+SELECT crypt('foox', '_J9..j2zz');
-update ctest set salt = gen_salt('xdes', 1001);
-update ctest set res = crypt(data, salt);
-select res = crypt(data, res) as "worked" from ctest;
+CREATE TABLE ctest (data text, res text, salt text);
+INSERT INTO ctest VALUES ('password', '', '');
-drop table ctest;
+UPDATE ctest SET salt = gen_salt('xdes', 1001);
+UPDATE ctest SET res = crypt(data, salt);
+SELECT res = crypt(data, res) AS "worked"
+FROM ctest;
+
+DROP TABLE ctest;
diff --git a/contrib/pgcrypto/sql/hmac-md5.sql b/contrib/pgcrypto/sql/hmac-md5.sql
index d3cd1f649d..ed2b65b7b8 100644
--- a/contrib/pgcrypto/sql/hmac-md5.sql
+++ b/contrib/pgcrypto/sql/hmac-md5.sql
@@ -2,43 +2,45 @@
-- HMAC-MD5
--
-select encode(hmac(
+SET autocommit TO 'on';
+
+SELECT encode(hmac(
'Hi There',
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
'md5'), 'hex');
-- 2
-select encode(hmac(
+SELECT encode(hmac(
'Jefe',
'what do ya want for nothing?',
'md5'), 'hex');
-- 3
-select encode(hmac(
+SELECT encode(hmac(
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
-- 4
-select encode(hmac(
+SELECT encode(hmac(
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
'md5'), 'hex');
-- 5
-select encode(hmac(
+SELECT encode(hmac(
'Test With Truncation',
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
'md5'), 'hex');
-- 6
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key - Hash Key First',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
-- 7
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
diff --git a/contrib/pgcrypto/sql/hmac-sha1.sql b/contrib/pgcrypto/sql/hmac-sha1.sql
index f08c438963..fb70424dce 100644
--- a/contrib/pgcrypto/sql/hmac-sha1.sql
+++ b/contrib/pgcrypto/sql/hmac-sha1.sql
@@ -2,43 +2,45 @@
-- HMAC-MD5
--
-select encode(hmac(
+SET autocommit TO 'on';
+
+SELECT encode(hmac(
'Hi There',
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
'sha1'), 'hex');
-- 2
-select encode(hmac(
+SELECT encode(hmac(
'Jefe',
'what do ya want for nothing?',
'sha1'), 'hex');
-- 3
-select encode(hmac(
+SELECT encode(hmac(
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
-- 4
-select encode(hmac(
+SELECT encode(hmac(
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
'sha1'), 'hex');
-- 5
-select encode(hmac(
+SELECT encode(hmac(
'Test With Truncation',
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
'sha1'), 'hex');
-- 6
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key - Hash Key First',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
-- 7
-select encode(hmac(
+SELECT encode(hmac(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
diff --git a/contrib/pgcrypto/sql/init.sql b/contrib/pgcrypto/sql/init.sql
index 8bddb73773..08ffeb4981 100644
--- a/contrib/pgcrypto/sql/init.sql
+++ b/contrib/pgcrypto/sql/init.sql
@@ -3,10 +3,11 @@
--
\set ECHO none
+SET autocommit TO 'on';
\i pgcrypto.sql
\set ECHO all
-- check for encoding fn's
-select encode('foo', 'hex');
-select decode('666f6f', 'hex');
+SELECT encode('foo', 'hex');
+SELECT decode('666f6f', 'hex');
diff --git a/contrib/pgcrypto/sql/md5.sql b/contrib/pgcrypto/sql/md5.sql
index 78e4cfee0f..0c851217b2 100644
--- a/contrib/pgcrypto/sql/md5.sql
+++ b/contrib/pgcrypto/sql/md5.sql
@@ -2,11 +2,13 @@
-- MD5 message digest
--
-select encode(digest('', 'md5'), 'hex');
-select encode(digest('a', 'md5'), 'hex');
-select encode(digest('abc', 'md5'), 'hex');
-select encode(digest('message digest', 'md5'), 'hex');
-select encode(digest('abcdefghijklmnopqrstuvwxyz', 'md5'), 'hex');
-select encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5'), 'hex');
-select encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5'), 'hex');
+SET autocommit TO 'on';
+
+SELECT encode(digest('', 'md5'), 'hex');
+SELECT encode(digest('a', 'md5'), 'hex');
+SELECT encode(digest('abc', 'md5'), 'hex');
+SELECT encode(digest('message digest', 'md5'), 'hex');
+SELECT encode(digest('abcdefghijklmnopqrstuvwxyz', 'md5'), 'hex');
+SELECT encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5'), 'hex');
+SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5'), 'hex');
diff --git a/contrib/pgcrypto/sql/rijndael.sql b/contrib/pgcrypto/sql/rijndael.sql
index fbacdc6dfc..793b07f362 100644
--- a/contrib/pgcrypto/sql/rijndael.sql
+++ b/contrib/pgcrypto/sql/rijndael.sql
@@ -2,41 +2,43 @@
-- AES / Rijndael-128 cipher
--
+SET autocommit TO 'on';
+
-- some standard Rijndael testvalues
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f', 'hex'),
'aes-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f1011121314151617', 'hex'),
'aes-ecb/pad:none'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
'aes-ecb/pad:none'), 'hex');
-- cbc
-select encode(encrypt(
+SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
'aes-cbc/pad:none'), 'hex');
-- key padding
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405', 'hex'),
'aes-cbc'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405060708090a0b0c0d0e0f10111213', 'hex'),
'aes-cbc'), 'hex');
-select encode(encrypt(
+SELECT encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b', 'hex'),
'aes-cbc'), 'hex');
diff --git a/contrib/pgcrypto/sql/sha1.sql b/contrib/pgcrypto/sql/sha1.sql
index 11ee5426cb..1c0fcd9072 100644
--- a/contrib/pgcrypto/sql/sha1.sql
+++ b/contrib/pgcrypto/sql/sha1.sql
@@ -2,11 +2,13 @@
-- SHA1 message digest
--
-select encode(digest('', 'sha1'), 'hex');
-select encode(digest('a', 'sha1'), 'hex');
-select encode(digest('abc', 'sha1'), 'hex');
-select encode(digest('message digest', 'sha1'), 'hex');
-select encode(digest('abcdefghijklmnopqrstuvwxyz', 'sha1'), 'hex');
-select encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'sha1'), 'hex');
-select encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha1'), 'hex');
+SET autocommit TO 'on';
+
+SELECT encode(digest('', 'sha1'), 'hex');
+SELECT encode(digest('a', 'sha1'), 'hex');
+SELECT encode(digest('abc', 'sha1'), 'hex');
+SELECT encode(digest('message digest', 'sha1'), 'hex');
+SELECT encode(digest('abcdefghijklmnopqrstuvwxyz', 'sha1'), 'hex');
+SELECT encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'sha1'), 'hex');
+SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha1'), 'hex');