Merge pull request 'fix(테이블타입): constraints SQL ARRAY_AGG → text 캐스트로 일원화' (#16) from johngreen into main
Build & Deploy to K8s / build-and-deploy (push) Successful in 8m45s
Build & Deploy to K8s / build-and-deploy (push) Successful in 8m45s
This commit was merged in pull request #16.
This commit is contained in:
@@ -10,7 +10,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -942,20 +941,6 @@ public class TableManagementService extends BaseService {
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<String> parseColumnArray(Object cols) {
|
||||
if (cols instanceof List) return (List<String>) cols;
|
||||
if (cols instanceof java.sql.Array arr) {
|
||||
try {
|
||||
Object raw = arr.getArray();
|
||||
if (raw instanceof Object[] arrObj) {
|
||||
return Arrays.stream(arrObj)
|
||||
.filter(Objects::nonNull)
|
||||
.map(Object::toString)
|
||||
.filter(s -> !s.isBlank())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.warn("parseColumnArray: java.sql.Array decode 실패 — fallback", e);
|
||||
}
|
||||
}
|
||||
if (cols instanceof String s) {
|
||||
return Arrays.stream(s.replace("{", "").replace("}", "").split(","))
|
||||
.filter(c -> !c.isBlank())
|
||||
|
||||
@@ -389,7 +389,7 @@
|
||||
<select id="getTablePrimaryKeyList" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
TC.CONNAME AS constraint_name
|
||||
, ARRAY_AGG(A.ATTNAME ORDER BY X.N) AS columns
|
||||
, ARRAY_AGG(A.ATTNAME ORDER BY X.N)::text AS columns
|
||||
FROM PG_CONSTRAINT TC
|
||||
JOIN PG_CLASS C
|
||||
ON TC.CONRELID = C.OID
|
||||
@@ -411,7 +411,7 @@
|
||||
SELECT
|
||||
I.RELNAME AS index_name
|
||||
, IX.INDISUNIQUE AS is_unique
|
||||
, ARRAY_AGG(A.ATTNAME ORDER BY X.N) AS columns
|
||||
, ARRAY_AGG(A.ATTNAME ORDER BY X.N)::text AS columns
|
||||
FROM PG_INDEX IX
|
||||
JOIN PG_CLASS T
|
||||
ON IX.INDRELID = T.OID
|
||||
|
||||
Reference in New Issue
Block a user