Search Postgresql Archives

libpq: empty arrays have rank 0 in binary results? whatever the type's rank?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi. Selecting/fetching an empty 1D array using a binary-mode PGresult,
gives me back 12 bytes, and the first 4, the rank, is 0, something I was not expecting.
I was expecting dims_rank = 1, then first_dim = 0

Normal? Next two ints are kinda useless given the 0 rank?
It's easy to fix, to support rank=0 for empty arrays, I just want to confirm.

Thanks, --DD

PS: On a side note; where can I find the sending code for arrays?
I didn't find the usual _send() and _recv() functions (but looking on github online...)

PPS: The relevant part of my code is below, for context:

    uint32_t dims_rank = read();
    if (dims_rank != 1) {
        throw std::runtime_error(fmt::format(
            "Unsupported array rank: Got {}; Want 1", dims_rank
        ));
    }
    uint32_t has_nulls = read();
    uint32_t actual_elem_oid = read();
    uint32_t first_dim = read();
    uint32_t lower_idx = read();

    ensure_oid(Oid{ actual_elem_oid }, expected_elem_oid);
    UNUSED(has_nulls);
    assert(lower_idx == 1);

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux