Informix:错误-528超过最大输出行大小(32767)

时间:2019-02-07 11:35:27

标签: informix bson

我正在Informix数据库(v。12FC9DE)上进行开发,并在执行以下SELECT时收到错误-528 (Maximum output rowsize exceeded)

SELECT 
    genbson(row("typ", "name", "sortName", "longName", "shortName", "status", "dates", "comment", "customer"), 1, 1)::JSON
FROM (
        (SELECT
            genbson(row("name", "shortName"), 1, 1) as "typ",
            '{"de":"Max"}'::JSON::BSON              as "name",
            '{"de":"Mustermann Max"}'::JSON::BSON   as "sortName", 
            '{"de":"Max Mustermann"}'::JSON::BSON   as "longName", 
            '{"de":"M. Mustermann"}'::JSON::BSON    as "shortName",
            'A'                                     as "status",
            genbson(row("street", "number", "zipCode", "city"), 1, 1)       as "address",
            genbson(row("phone","fax", "mailaddress", "website"), 1, 1)     as "contact",
            genbson(row("birthDate", "retireDate"), 1, 1)                   as "dates",
            'red'                                   as "comment",
            genbson(row("id"), 1, 1)                as "customer"
        FROM (
            (SELECT             
                '{"de":"Person"}'::JSON::BSON   as "name",
                '{"de":"Person"}'::JSON::BSON   as "shortName",
                'Hauptstraße'                   as "street",
                '1'                             as "number",
                '12345'                         as "zipCode",
                'Musterhausen'                  as "city",
                '012-3456789'                   as "phone",
                '012-34567810'                  as "fax",               
                'info@mustermann.de'            as "mailaddress",
                'www.mustermann.de'             as "website",
                '1980-02-27'::date              as "birthDate",             
                null::date                      as "retireDate",
                'abdgt-756474-eerrr'            as "id"
            FROM  systables where tabid = 1) as a) 
    ) as b);

使用此语句,我尝试将多个列组合到一个JSON / BSON对象。在此示例中,通过:: JSON :: BSON转换的字符串在已合并值的存储过程中。

通过将其中两个值更改为普通字符串,不会出现错误,并且SELECT成功:

SELECT 
    genbson(row("typ", "name", "sortName", "longName", "shortName", "status", "dates", "comment", "customer"), 1, 1)::JSON
FROM (
        (SELECT
            genbson(row("name", "shortName"), 1, 1) as "typ",
            '{"de":"Max"}'::JSON::BSON              as "name",
            '{"de":"Mustermann Max"}'::JSON::BSON   as "sortName", 
            '{"de":"Max Mustermann"}'               as "longName", 
            '{"de":"M. Mustermann"}'                as "shortName",
            'A'                                     as "status",
            genbson(row("street", "number", "zipCode", "city"), 1, 1)       as "address",
            genbson(row("phone","fax", "mailaddress", "website"), 1, 1)     as "contact",
            genbson(row("birthDate", "retireDate"), 1, 1)                   as "dates",
            'red'                                   as "comment",
            genbson(row("id"), 1, 1)                as "customer"
        FROM (
            (SELECT             
                '{"de":"Person"}'::JSON::BSON   as "name",
                '{"de":"Person"}'::JSON::BSON   as "shortName",
                'Hauptstraße'                   as "street",
                '1'                             as "number",
                '12345'                         as "zipCode",
                'Musterhausen'                  as "city",
                '012-3456789'                   as "phone",
                '012-34567810'                  as "fax",               
                'info@mustermann.de'            as "mailaddress",
                'www.mustermann.de'             as "website",
                '1980-02-27'::date              as "birthDate",             
                null::date                      as "retireDate",
                'abdgt-756474-eerrr'            as "id"
            FROM  systables where tabid = 1) as a) 
    ) as b);

我使用DBeaver或DataStudio执行SELECT。 两者都出现错误。

我的问题是:为什么? ;)

对此有何建议? 可能是已知的错误,还是我做错了什么?

最好的问候 基普(S. Kip)

1 个答案:

答案 0 :(得分:0)

要规避实际上是4kB-per-BSON的4kB-per-genbson(),可以在查询中将每个genbson(...)调用都转换为lvarchar(max_expected_length)。

SELECT
    genbson(row("typ", "name", "sortName", "longName", "shortName", "status", "dates", "comment", "customer"), 1, 1)::JSON::LVARCHAR(400)
FROM (
        (SELECT
            genbson(row("name", "shortName"), 1, 1)::JSON::LVARCHAR(200) as "typ",
            '{"de":"Max"}'                          as "name",
            '{"de":"Mustermann Max"}'               as "sortName",
            '{"de":"Max Mustermann"}'               as "longName",
            '{"de":"M. Mustermann"}'                as "shortName",
            'A'                                     as "status",
            genbson(row("street", "number", "zipCode", "city"), 1, 1)::JSON::LVARCHAR(200) as "address",
            genbson(row("phone","fax", "mailaddress", "website"), 1, 1)::JSON::LVARCHAR(200) as "contact",
            genbson(row("birthDate", "retireDate"), 1, 1)::JSON::LVARCHAR(200) as "dates",
            'red'                                   as "comment",
            genbson(row("id"), 1, 1)::JSON::LVARCHAR(200) as "customer"
        FROM (
            (SELECT
                '{"de":"Person"}'               as "name",
                '{"de":"Person"}'               as "shortName",
                'Hauptstraße'                   as "street",
                '1'                             as "number",
                '12345'                         as "zipCode",
                'Musterhausen'                  as "city",
                '012-3456789'                   as "phone",
                '012-34567810'                  as "fax",
                'info@mustermann.de'            as "mailaddress",
                'www.mustermann.de'             as "website",
                '1980-02-27'::date              as "birthDate",
                null::date                      as "retireDate",
                'abdgt-756474-eerrr'            as "id"
            FROM  systables where tabid = 1) as a)
    ) as b);

(我还删除了:: JSON :: BSON强制转换。)