【问题标题】:Use criteria or query dsl to find all tables names in a given schema使用条件或查询 dsl 查找给定模式中的所有表名
【发布时间】:2021-04-18 17:30:48
【问题描述】:

有没有办法使用标准 API 或查询 DSL(甚至是数据库元数据)在给定的模式名称中找到所有以 t_ 开头的表名?如果它存在,您能否告诉我如何使用模式名称或视图来做到这一点?我正在使用 PostgreSQL 作为数据库。 我不想使用原生查询。

【问题讨论】:

    标签: postgresql jpa criteria-api


    【解决方案1】:

    是的,您可以使用以下查询:

    SELECT table_catalog,table_schema,table_name
    FROM information_schema.tables
    WHERE table_name LIKE 't\_%'
    AND table_type='BASE TABLE' -- to filter out Tables only, remove if you need to see views as well
    

    【讨论】:

      猜你喜欢
      • 2011-04-04
      • 1970-01-01
      • 1970-01-01
      • 2020-10-02
      • 1970-01-01
      • 1970-01-01
      • 2017-10-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多