Adalennis opened a new issue, #9373:
URL: https://github.com/apache/hop/issues/9373

   ### Apache Hop version?
   
   2.20.0
   
   ### Java version?
   
   Java 21
   
   ### Operating system
   
   macOS
   
   ### What happened?
   
   Reproduced on 2.20.0; the code involved is unchanged on main.
   
   With an empty Schema name, Get table names fails as soon as it lists a table 
that is not in the connection's default schema. The sample 
`transforms/get-table-names.hpl` (added in #8786) fails on its H2 `hop-samples` 
connection:
   
   ```
   Couldn't get field info from [SELECT * FROM CONSTANTS]
   Table "CONSTANTS" not found; SQL statement:
   SELECT * FROM CONSTANTS [42102-252]
   get table names.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=1)
   ```
   
   With the Schema name set to `PUBLIC`, the same pipeline returns 7 rows 
without errors.
   
   PostgreSQL gives the same result. In a database with `public.t_pub` and 
`sales.t_sales`, an empty Schema name fails with `ERROR: relation "t_sales" 
does not exist`, and Schema name `sales` works.
   
   Steps:
   
   1. Open `transforms/get-table-names.hpl` in the samples project, or use any 
Get table names transform with "Include tables" on and an empty Schema name, on 
a database with a table outside the default schema.
   2. Run the pipeline.
   
   Cause: in `GetTableNames.processIncludeTable()`, 
`getTablenames(realSchemaName, ...)` with an empty schema returns the tables of 
every schema, for H2 also those in `INFORMATION_SCHEMA`. For each table the 
transform then calls `getPrimaryKeyColumnNames()` and 
`getTableFieldsMeta(realSchemaName, tableNameWithoutSchema)` with the empty 
schema and the name without its schema. The database looks for that name in the 
default schema and doesn't find it. The field lookup runs for every table, also 
when no SQL creation field is set, so leaving that field empty doesn't help.
   
   The integration test `0024-get-table-names` also uses an empty schema, but 
passes because all its PostgreSQL tables are in `public`.
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Transforms


-- 
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