Message-ID: From: "JavaUnchained (@JavaUnchained)" To: "pgjdbc/pgjdbc" Date: Mon, 28 Oct 2024 10:43:54 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #3396: SQLData Support In-Reply-To: References: List-Id: X-GitHub-Author-Login: JavaUnchained X-GitHub-Comment-Id: 2441227160 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2024-10-28T15:00:16Z X-GitHub-Issue: 3396 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3396#issuecomment-2441227160 Content-Type: text/plain; charset=utf-8 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> map) throws SQLException { final BaseConnection connection = getConnection(); int elementOid = 0; // unspecified if (map != null && typeMap.size() == 1) { Optional>> entryOp = typeMap.entrySet().stream().findFirst(); if (entryOp.isPresent()) { Map.Entry> 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.