更新时间:2024-04-25 GMT+08:00
分享

密态函数和操作符

  • byteawithoutorderwithequalcolin(cstring)

    描述:将输入转码转化成内部byteawithoutorderwithequalcol形式。

    参数类型:cstring

    返回值类型:byteawithoutorderwithequalcol

  • byteawithoutorderwithequalcolout(byteawithoutorderwithequalcol)

    描述:将内部byteawithoutorderwithequalcol类型的数据转码转化为cstring类型。

    参数类型:byteawithoutorderwithequalcol

    返回值类型:cstring

  • byteawithoutorderwithequalcolsend(byteawithoutorderwithequalcol)

    描述:将byteawithoutorderwithequalcol类型的数据转码转化为bytea类型。

    参数类型:byteawithoutorderwithequalcol

    返回值类型:bytea

  • byteawithoutorderwithequalcolrecv(internal)

    描述:将internal类型的数据转码转化为byteawithoutorderwithequalcol类型。

    参数类型:internal

    返回值类型:byteawithoutorderwithequalcol

  • byteawithoutorderwithequalcoltypmodin(cstring[])

    描述:将cstring[]类型的数据转码转化为byteawithoutorderwithequalcol类型。

    参数类型:cstring[]

    返回值类型:int4

  • byteawithoutorderwithequalcoltypmodout(int4)

    描述:将int4类型的数据转码转化为cstring类型。

    参数类型:int4

    返回值类型:cstring

  • byteawithoutordercolin(cstring)

    描述:将输入转码转化成内部byteawithoutordercolin形式。

    参数类型:cstring

    返回值类型:byteawithoutordercol

  • byteawithoutordercolout(byteawithoutordercol)

    描述:将内部byteawithoutordercol类型的数据转码转化为cstring类型。

    参数类型:byteawithoutordercol

    返回值类型:cstring

  • byteawithoutordercolsend(byteawithoutordercol)

    描述:将byteawithoutordercol类型的数据转码转化为bytea类型。

    参数类型:byteawithoutordercol

    返回值类型:bytea

  • byteawithoutordercolrecv(internal)

    描述:将internal类型的数据转码转化为byteawithoutordercol类型。

    参数类型:internal

    返回值类型:byteawithoutordercol

  • byteawithoutorderwithequalcolcmp(byteawithoutorderwithequalcol, byteawithoutorderwithequalcol)

    描述:比较两个byteawithoutorderwithequalcol类型的数据大小,若第一个参数小于第二个参数,返回-1,若等于,返回0,若大于,则返回1。

    参数类型:byteawithoutorderwithequalcol, byteawithoutorderwithequalcol

    返回值类型:int4

  • byteawithoutorderwithequalcolcmpbytear(byteawithoutorderwithequalcol, bytea)

    描述:比较byteawithoutorderwithequalcol和bytea数据大小,若第一个参数小于第二个参数,返回-1,若等于,返回0,若大于,则返回1。

    参数类型:byteawithoutorderwithequalcol, bytea

    返回值类型:int4

  • byteawithoutorderwithequalcolcmpbyteal(bytea, byteawithoutorderwithequalcol)

    描述:比较bytea和byteawithoutorderwithequalcol数据大小,若第一个参数小于第二个参数,返回-1,若等于,返回0,若大于,则返回1。

    参数类型:bytea, byteawithoutorderwithequalcol

    返回值类型:int4

  • byteawithoutorderwithequalcoleq(byteawithoutorderwithequalcol, byteawithoutorderwithequalcol)

    描述:比较两个byteawithoutorderwithequalcol类型的数据是否相同,相同则返回true,否则返回false。

    参数类型:byteawithoutorderwithequalcol, byteawithoutorderwithequalcol

    返回值类型:bool

  • byteawithoutorderwithequalcoleqbyteal(bytea, byteawithoutorderwithequalcol)

    描述:比较bytea和byteawithoutorderwithequalcol数据是否相同,相同则返回true,否则返回false。

    参数类型:bytea,byteawithoutorderwithequalcol

    返回值类型:bool

  • byteawithoutorderwithequalcoleqbytear(byteawithoutorderwithequalcol, bytea)

    描述:比较byteawithoutorderwithequalcol和bytea数据是否相同,相同则返回true,否则返回false。

    参数类型:byteawithoutorderwithequalcol, bytea

    返回值类型:bool

  • byteawithoutorderwithequalcolne(byteawithoutorderwithequalcol, byteawithoutorderwithequalcol)

    描述:比较两个byteawithoutorderwithequalcol类型的数据是否不相同,不相同则返回true,否则返回false。

    参数类型:byteawithoutorderwithequalcol, byteawithoutorderwithequalcol

    返回值类型:bool

  • byteawithoutorderwithequalcolnebyteal(bytea, byteawithoutorderwithequalcol)

    描述:比较bytea和byteawithoutorderwithequalcol数据是否相同,相同则返回true,否则返回false。

    参数类型:bytea,byteawithoutorderwithequalcol

    返回值类型:bool

  • byteawithoutorderwithequalcolnebytear(byteawithoutorderwithequalcol, bytea)

    描述:比较byteawithoutorderwithequalcol和bytea数据是否不相同,相同则返回true,否则返回false。

    参数类型:byteawithoutorderwithequalcol, bytea

    返回值类型:bool

  • hll_hash_byteawithoutorderwithequalcol(byteawithoutorderwithequalcol)

    描述:返回byteawithoutorderwithequalcol的hll哈希值。

    参数类型:byteawithoutorderwithequalcol

    返回值类型:hll_hashval

示例

byteawithoutorderwithequalcolin、byteawithoutorderwithequalcolout等密态等值函数为数据库内核中数据类型byteawithoutorderwithequalcol指定的in、out、send、recv等读写格式转换函数,具体可参考bytea类型的byteain、byteaout等函数,但会对本地的cek进行验证,需要密文字段中有本地存在的cekoid才能执行成功。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
-- 例如存在加密表int_type,int_col2为其加密列

-- 使用非密态客户端连接数据库,查询加密列密文
gaussdb=# SELECT int_col2 FROM int_type;
                                                                       int_col2
------------------------------------------------------------------------------------------------------------------------------------------------------
 \x01c35301bf421c8edf38c34704bcc82838742917778ccb402a1b7452ad4a6ac7371acc0ac33100000035fe3424919854c86194f1aa5bb4e1ca656e8fc6d05324a1419b69f488bdc3c6
(1 row)

-- 将加密列密文当做byteawithoutorderwithequalcolin入参,格式从cstring输入转码转化成内部byteawithoutorderwithequalcol形式
gaussdb=# SELECT byteawithoutorderwithequalcolin('\x01c35301bf421c8edf38c34704bcc82838742917778ccb402a1b7452ad4a6ac7371acc0ac33100000035fe3424919854c86194f1aa5bb4e1ca656e8fc6d05324a1419b69f488bdc3c6');
                                                           byteawithoutorderwithequalcolin
------------------------------------------------------------------------------------------------------------------------------------------------------
 \x01c35301bf421c8edf38c34704bcc82838742917778ccb402a1b7452ad4a6ac7371acc0ac33100000035fe3424919854c86194f1aa5bb4e1ca656e8fc6d05324a1419b69f488bdc3c6
(1 row)       

由于byteawithoutorderwithequalcolin等的实现会对cek进行查找,并且判断是否为正常加密后的数据类型。

因此如果用户输入数据的格式不是加密后的数据格式,并且在本地不存在对应cek的情况下,会返回错误。

 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...
   
gaussdb=# 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...
                                                        ^
分享:

    相关文档

    相关产品