Use parameterized query in getRemoteTableLocalName (#16651)
This PR updates the `isNameAvailable` function in `getRemoteTableLocalName` to use parameterized queries instead of string interpolation when querying the information_schema. **Changes:** - Replaced template literal interpolation with PostgreSQL's `$1`, `$2` placeholder syntax - Parameters are now passed as a separate array argument to `dataSource.query()` This follows best practices for database queries.
This commit is contained in:
+2
-1
@@ -21,7 +21,8 @@ const isNameAvailable = async (
|
||||
) => {
|
||||
const numberOfTablesWithSameName = +(
|
||||
await coreDataSource.query(
|
||||
`SELECT count(table_name) FROM information_schema.tables WHERE table_name LIKE '${tableName}' AND table_schema IN ('core', '${workspaceSchemaName}')`,
|
||||
`SELECT count(table_name) FROM information_schema.tables WHERE table_name LIKE $1 AND table_schema IN ('core', $2)`,
|
||||
[tableName, workspaceSchemaName],
|
||||
)
|
||||
)[0].count;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user