pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: JavaUnchained (@JavaUnchained) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] PR #3396: SQLData Support
Date: Mon, 28 Oct 2024 10:43:54 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Hi. I think the problem with the array is due to the fact that the OID is specified for a simple TEXT and not TEXT_ARRAY, so TypeInfo does not return anything in response to getPGArrayElement . But this does not solve the typing problem.


If we had a buildArray map with only 1 element in it, then everything would be pretty trivial and would look something like this (below are just thoughts) :

```
private Object buildArray(ArrayDecoding.PgArrayList input, int index, int count, @Nullable Map<String, Class<?>> map) throws SQLException {
    final BaseConnection connection = getConnection();
    int elementOid = 0; // unspecified
    if (map != null && typeMap.size() == 1) {
      Optional<Map.Entry<String, Class<?>>> entryOp = typeMap.entrySet().stream().findFirst();
      if (entryOp.isPresent()) {
        Map.Entry<String, Class<?>> entry = entryOp.get();
        if (SQLData.class.isAssignableFrom(entry.getValue()) || connection.getTypeInfo().getPGType(entry.getKey()) != 0) { 
          elementOid = connection.getTypeInfo().getPGType(entry.getKey());
        }
      }
    }
    Object array = ArrayDecoding.readStringArray(index, count, elementOid , input, connection);
```
But I also doubt that someone will specify not UDT in the map, but simple types too

p.s I'm sorry for writing this here. I'm just very interested in the functionality that you've implemented.

view thread (67+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] PR #3396: SQLData Support
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox