#include "fmgr.h"
#include "access/skey.h"
#include "utils/builtins.h"
+#include "utils/bytea.h"
#include "utils/cash.h"
#include "utils/date.h"
#include "utils/inet.h"
set enable_seqscan=off;
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
CREATE TABLE test_bytea (
i bytea
);
set enable_seqscan=off;
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
CREATE TABLE test_bytea (
i bytea
*/
#include "btree_gist.h"
#include "btree_utils_var.h"
-#include "utils/builtins.h"
+#include "utils/bytea.h"
#include "utils/varbit.h"
*/
#include "btree_gist.h"
#include "btree_utils_var.h"
-#include "utils/builtins.h"
+#include "utils/bytea.h"
/*
-- expected failures on duplicate key
INSERT INTO try (name) VALUES ('a');
ERROR: duplicate key value violates unique constraint "try_pkey"
+DETAIL: Key (name)=(a) already exists.
INSERT INTO try (name) VALUES ('A');
ERROR: duplicate key value violates unique constraint "try_pkey"
+DETAIL: Key (name)=(A) already exists.
INSERT INTO try (name) VALUES ('aB');
ERROR: duplicate key value violates unique constraint "try_pkey"
+DETAIL: Key (name)=(aB) already exists.
-- Make sure that citext_smaller() and citext_lager() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t;
t
t
(1 row)
-SELECT 'foo'::bytea::citext = 'foo' AS t;
- t
----
- t
-(1 row)
-
-SELECT 'foo'::citext::bytea = 'foo'::bytea AS t;
- t
----
- t
-(1 row)
-
SELECT '100'::money::citext = '$100.00' AS t;
t
---
-- expected failures on duplicate key
INSERT INTO try (name) VALUES ('a');
ERROR: duplicate key value violates unique constraint "try_pkey"
+DETAIL: Key (name)=(a) already exists.
INSERT INTO try (name) VALUES ('A');
ERROR: duplicate key value violates unique constraint "try_pkey"
+DETAIL: Key (name)=(A) already exists.
INSERT INTO try (name) VALUES ('aB');
ERROR: duplicate key value violates unique constraint "try_pkey"
+DETAIL: Key (name)=(aB) already exists.
-- Make sure that citext_smaller() and citext_lager() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t;
t
t
(1 row)
-SELECT 'foo'::bytea::citext = 'foo' AS t;
- t
----
- t
-(1 row)
-
-SELECT 'foo'::citext::bytea = 'foo'::bytea AS t;
- t
----
- t
-(1 row)
-
SELECT '100'::money::citext = '$100.00' AS t;
t
---
SELECT 'f'::"char"::citext = 'f' AS t;
SELECT 'f'::citext::"char" = 'f'::"char" AS t;
-SELECT 'foo'::bytea::citext = 'foo' AS t;
-SELECT 'foo'::citext::bytea = 'foo'::bytea AS t;
-
SELECT '100'::money::citext = '$100.00' AS t;
SELECT '100'::citext::money = '100'::money AS t;
--
-- Blowfish cipher
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
-- some standard Blowfish testvalues
SELECT encode(encrypt(
decode('0000000000000000', 'hex'),
SET client_min_messages = warning;
\set ECHO none
RESET client_min_messages;
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
-- check for encoding fn's
SELECT encode('foo', 'hex');
encode
--
-- PGP Armor
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
select armor('');
armor
-----------------------------
-----BEGIN PGP MESSAGE-----
-
- =twTO
- -----END PGP MESSAGE-----
-
+
+ =twTO
+ -----END PGP MESSAGE-----
+
(1 row)
select armor('test');
armor
-----------------------------
-----BEGIN PGP MESSAGE-----
-
- dGVzdA==
- =+G7Q
- -----END PGP MESSAGE-----
-
+
+ dGVzdA==
+ =+G7Q
+ -----END PGP MESSAGE-----
+
(1 row)
select dearmor(armor(''));
dearmor
---------
-
+
(1 row)
select dearmor(armor('zooka'));
dearmor
---------
- zooka
+ zooka
(1 row)
select armor('0123456789abcdef0123456789abcdef0123456789abcdef
0123456789abcdef0123456789abcdef0123456789abcdef');
armor
------------------------------------------------------------------------------
- -----BEGIN PGP MESSAGE-----
-
+ -----BEGIN PGP MESSAGE-----
+
MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmCjAxMjM0NTY3
- ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZg==
- =JFw5
- -----END PGP MESSAGE-----
-
+ ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZg==
+ =JFw5
+ -----END PGP MESSAGE-----
+
(1 row)
-- lots formatting
-----END PGP MESSAGE-----');
dearmor
---------
- zooka
+ zooka
(1 row)
-- lots messages
');
dearmor
---------
- right
+ right
(1 row)
-- bad crc
--
-- PGP encrypt
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'), 'key');
pgp_sym_decrypt
-----------------
--
-- PGP Public Key Encryption
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
-- successful encrypt/decrypt
select pgp_pub_decrypt(
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
--
-- AES / Rijndael-128 cipher
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
-- some standard Rijndael testvalues
SELECT encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
--
-- Blowfish cipher
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
-- some standard Blowfish testvalues
SELECT encode(encrypt(
\set ECHO all
RESET client_min_messages;
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
+
-- check for encoding fn's
SELECT encode('foo', 'hex');
SELECT decode('666f6f', 'hex');
--
-- PGP Armor
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
select armor('');
select armor('test');
--
-- PGP encrypt
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'), 'key');
--
-- PGP Public Key Encryption
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
-- successful encrypt/decrypt
select pgp_pub_decrypt(
--
-- AES / Rijndael-128 cipher
--
+-- ensure consistent test output regardless of the default bytea format
+SET bytea_output TO escape;
-- some standard Rijndael testvalues
SELECT encode(encrypt(