marta-jankovics commented on code in PR #3385:
URL: https://github.com/apache/fineract/pull/3385#discussion_r1303972276


##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/database/PostgreSQLQueryService.java:
##########
@@ -54,8 +54,10 @@ public boolean isTablePresent(DataSource dataSource, String 
tableName) {
     @Override
     public SqlRowSet getTableColumns(DataSource dataSource, String tableName) {
         JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
-        String sql = "SELECT attname AS COLUMN_NAME, not attnotnull AS 
IS_NULLABLE, atttypid::regtype  AS DATATYPE, attlen AS 
CHARACTER_MAXIMUM_LENGTH, attnum = 1 AS COLUMN_KEY FROM pg_attribute WHERE 
attrelid = '\""
-                + tableName + "\"'::regclass AND attnum > 0 AND NOT 
attisdropped ORDER BY attnum";
+        String sql = "SELECT column_name, is_nullable, data_type,"

Review Comment:
   Found a solution to read from pg_attribute, but still we need to call a 
stored proc from information_schema. This query seems to be slower than 
pg_attribute and faster than information_schema.columns, but the results are 
ambiguous.
   
   SELECT attname AS column_name, not attnotnull AS is_nullable, 
atttypid::regtype AS data_type, 
NULLIF(information_schema._pg_char_max_length(atttypid, atttypmod), -1) AS 
max_length, attnum = 1 AS column_key
   FROM pg_attribute WHERE attrelid = '"dt_savings_transaction_61"'::regclass 
AND attnum > 0 AND NOT attisdropped ORDER BY attnum;



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to