Updated on 2024-03-21 GMT+08:00

Encrypted Functions and Operators

  • byteawithoutorderwithequalcolin(cstring)

    Description: Converts input data to the internal byteawithoutorderwithequalcol format.

    Parameter type: cstring

    Return type: byteawithoutorderwithequalcol

  • byteawithoutorderwithequalcolout(byteawithoutorderwithequalcol)

    Description: Converts internal data of the byteawithoutorderwithequalcol type to data of the cstring type.

    Parameter type: byteawithoutorderwithequalcol

    Return type: cstring

  • byteawithoutorderwithequalcolsend(byteawithoutorderwithequalcol)

    Description: Converts data of the byteawithoutorderwithequalcol type to data of the bytea type.

    Parameter type: byteawithoutorderwithequalcol

    Return type: bytea

  • byteawithoutorderwithequalcolrecv(internal)

    Description: Converts data of the internal type to data of the byteawithoutorderwithequalcol type.

    Parameter type: internal

    Return type: byteawithoutorderwithequalcol

  • byteawithoutorderwithequalcoltypmodin(cstring[])

    Description: Converts data of the cstring[] type to data of the byteawithoutorderwithequalcol type.

    Parameter type: cstring[]

    Return type: int4

  • byteawithoutorderwithequalcoltypmodout(int4)

    Description: Converts data of the int4 type into data of the cstring type.

    Parameter type: int4

    Return type: cstring

  • byteawithoutordercolin(cstring)

    Description: Converts input data to the internal byteawithoutordercolin format.

    Parameter type: cstring

    Return type: byteawithoutordercol

  • byteawithoutordercolout(byteawithoutordercol)

    Description: Converts internal data of the byteawithoutordercol type to data of the cstring type.

    Parameter type: byteawithoutordercol

    Return type: cstring

  • byteawithoutordercolsend(byteawithoutordercol)

    Description: Converts data of the byteawithoutordercol type to data of the bytea type.

    Parameter type: byteawithoutordercol

    Return type: bytea

  • byteawithoutordercolrecv(internal)

    Description: Converts data of the internal type to data of the byteawithoutordercol type.

    Parameter type: internal

    Return type: byteawithoutordercol

  • byteawithoutorderwithequalcolcmp(byteawithoutorderwithequalcol, byteawithoutorderwithequalcol)

    Description: Compares two byteawithoutorderwithequalcol data sizes. If the first data size is smaller than the second one, –1 is returned. If the first data size is equal to the second one, 0 is returned. If the first data size is larger than the second one, 1 is returned.

    Parameter type: byteawithoutorderwithequalcol, byteawithoutorderwithequalcol

    Return type: int4

  • byteawithoutorderwithequalcolcmpbytear(byteawithoutorderwithequalcol, bytea)

    Description: Compares the byteawithoutorderwithequalcol and bytea data sizes. If the first data size is smaller than the second one, –1 is returned. If the first data size is equal to the second one, 0 is returned. If the first data size is larger than the second one, 1 is returned.

    Parameter type: byteawithoutorderwithequalcol or bytea

    Return type: int4

  • byteawithoutorderwithequalcolcmpbyteal(bytea, byteawithoutorderwithequalcol)

    Description: Compares the bytea and byteawithoutorderwithequalcol data sizes. If the first data size is smaller than the second one, –1 is returned. If the first data size is equal to the second one, 0 is returned. If the first data size is larger than the second one, 1 is returned.

    Parameter type: bytea, byteawithoutorderwithequalcol

    Return type: int4

  • byteawithoutorderwithequalcoleq(byteawithoutorderwithequalcol, byteawithoutorderwithequalcol)

    Description: Compares two byteawithoutorderwithequalcol data records. If they are the same, true is returned. Otherwise, false is returned.

    Parameter type: byteawithoutorderwithequalcol, byteawithoutorderwithequalcol

    Return type: Boolean

  • byteawithoutorderwithequalcoleqbyteal(bytea, byteawithoutorderwithequalcol)

    Description: Compares the bytea and byteawithoutorderwithequalcol data records. If they are the same, true is returned. Otherwise, false is returned.

    Parameter type: bytea, byteawithoutorderwithequalcol

    Return type: Boolean

  • byteawithoutorderwithequalcoleqbytear(byteawithoutorderwithequalcol, bytea)

    Description: Compares the byteawithoutorderwithequalcol and bytea data records. If they are the same, true is returned. Otherwise, false is returned.

    Parameter type: byteawithoutorderwithequalcol, bytea

    Return type: Boolean

  • byteawithoutorderwithequalcolne(byteawithoutorderwithequalcol, byteawithoutorderwithequalcol)

    Description: Compares two byteawithoutorderwithequalcol data records. If they are different, true is returned. Otherwise, false is returned.

    Parameter type: byteawithoutorderwithequalcol, byteawithoutorderwithequalcol

    Return type: Boolean

  • byteawithoutorderwithequalcolnebyteal(bytea, byteawithoutorderwithequalcol)

    Description: Compares the bytea and byteawithoutorderwithequalcol data records. If they are the same, true is returned. Otherwise, false is returned.

    Parameter type: bytea, byteawithoutorderwithequalcol

    Return type: Boolean

  • byteawithoutorderwithequalcolnebytear(byteawithoutorderwithequalcol, bytea)

    Description: Compares the byteawithoutorderwithequalcol and bytea data records. If they are the same, true is returned. Otherwise, false is returned.

    Parameter type: byteawithoutorderwithequalcol, bytea

    Return type: Boolean

  • hll_hash_byteawithoutorderwithequalcol(byteawithoutorderwithequalcol)

    Description: Returns the hll hash value of byteawithoutorderwithequalcol.

    Parameter type: byteawithoutorderwithequalcol

    Return type: hll_hashval

Example

Encrypted equality functions such as byteawithoutorderwithequalcolin and byteawithoutorderwithequalcolout are read/write format conversion functions such as in, out, send, and recv specified by the data type byteawithoutorderwithequalcol in the database kernel. For details, see the byteain and byteaout functions of the bytea type. However, the local CEK is verified, and the function can be successfully executed only when the encrypted column contains a cekoid that exists on the local host.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
-- For example, if the int_type encrypted table exists, int_col2 is the encrypted column.

-- Use a non-encrypted client to connect to the database and query the ciphertext of the encrypted column.
gaussdb=# select int_col2 from int_type;
                                                                       int_col2
------------------------------------------------------------------------------------------------------------------------------------------------------
 \x01c35301bf421c8edf38c34704bcc82838742917778ccb402a1b7452ad4a6ac7371acc0ac33100000035fe3424919854c86194f1aa5bb4e1ca656e8fc6d05324a1419b69f488bdc3c6
(1 row)

-- The ciphertext of the encrypted column is used as the input parameter of byteawithoutorderwithequalcolin. The format is converted from cstring to byteawithoutorderwithequalcol.
gaussdb=# select byteawithoutorderwithequalcolin('\x01c35301bf421c8edf38c34704bcc82838742917778ccb402a1b7452ad4a6ac7371acc0ac33100000035fe3424919854c86194f1aa5bb4e1ca656e8fc6d05324a1419b69f488bdc3c6');
                                                           byteawithoutorderwithequalcolin
------------------------------------------------------------------------------------------------------------------------------------------------------
 \x01c35301bf421c8edf38c34704bcc82838742917778ccb402a1b7452ad4a6ac7371acc0ac33100000035fe3424919854c86194f1aa5bb4e1ca656e8fc6d05324a1419b69f488bdc3c6
(1 row)       

Implementations such as byteawithoutorderwithequalcolin search for CEK and determine whether it is a normal encrypted data type.

Therefore, if the format of the data entered by the user is not the encrypted data format and the corresponding CEK does not exist on the local host, an error is returned.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
gaussdb=# SELECT * FROM byteawithoutorderwithequalcolsend('\x907219912381298461289346129'::byteawithoutorderwithequalcol);
ERROR:  cek with OID 596711794 not found
LINE 1: SELECT * FROM byteawithoutorderwithequalcolsend('\x907219912...
                                                        ^
gaussdb=# SELECT * FROM byteawithoutordercolout('\x90721901999999999999912381298461289346129');
ERROR:  cek with OID 2566986098 not found
LINE 1: SELECT * FROM byteawithoutordercolout('\x9072190199999999999...
   
SELECT * FROM byteawithoutorderwithequalcolrecv('\x90721901999999999999912381298461289346129'::byteawithoutorderwithequalcol);
ERROR:  cek with OID 2566986098 not found
                                           ^
gaussdb=# SELECT * FROM byteawithoutorderwithequalcolsend('\x90721901999999999999912381298461289346129'::byteawithoutorderwithequalcol);
ERROR:  cek with OID 2566986098 not found
LINE 1: SELECT * FROM byteawithoutorderwithequalcolsend('\x907219019...
                                                        ^