Retrieve all Indexes for a given Table with JDBC

前端 未结 4 1386
臣服心动
臣服心动 2021-01-19 21:29

I want to write a SpringBatch Tasklet, that automatically activates or de-activates all indexes for a given database table. The code needs to work independantly of the DBMS

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-19 21:39

    I had a similar problem and the cause in my case was, the case-sensitivity. I had to write the whole tablename in lower case letters (like it appeared in the result set of the SQL "SELECT tablename,indexname,indexdef FROM pg_indexes".

    I also changed the second last parameter ("unique" parameter) to false to get all indexes (otherwise I just got the primary key).

    Hope this helps.

提交回复
热议问题