zoukankan      html  css  js  c++  java
  • 查询表名及列名长度超过一定长度的SQL

    apple=# select * from (select a.relname, char_length(a.relname) as tb_name_length, b.attname, char_length(b.attname) as att_name_length, d.typname, b.attlen, b.attnum from pg_class a, pg_attribute b ,pg_tables c , pg_type d where b.attrelid = a.oid and b.attnum > 0  and c.schemaname = 'public' and a.relname = c.tablename and b.atttypid = d.oid ) as d where d.tb_name_length > 10 or att_name_length > 10;
            relname        | tb_name_length |      attname       | att_name_length |  typname  | attlen | attnum
    -----------------------+----------------+--------------------+-----------------+-----------+--------+--------
     test_0001              |              8 | datatypename       |              12 | varchar   |     -1 |      2
     test_0001              |              8 | startuptime        |              11 | timestamp |      8 |      5
    
    

    暂时这样写,后续修改从pg_namespace获取schema为public的表:

    select * from (select a.relname, char_length(a.relname) as tb_name_length, b.attname, char_length(b.attname) as att_name_length, d.typname, b.attlen, b.attnum from pg_class a, pg_attribute b ,pg_namespace c , pg_type d where b.attrelid = a.oid and b.attnum > 0  and c.nspname = 'public' and a.relnamespace = c.oid and b.atttypid = d.oid ) as d where d.tb_name_length > 10 or att_name_length > 10;
    
  • 相关阅读:
    js
    第三方jar包导入unity
    xcode打包苹果应用遇到的问题及解决方法
    ios打包unity应用以及配置签名
    unity打包安卓应用及生成签名
    Unity实现用户条款弹窗及登录
    Unity协程实现伪加载页面
    Unity配置安卓开发环境
    Unity中用Mono插件解析xml文件
    Excel关联xml文件
  • 原文地址:https://www.cnblogs.com/kuang17/p/10064511.html
Copyright © 2011-2022 走看看