PostgreSQL中SQL Server的sysobject的替代 [英] Alternative to SQL Server's sysobjects in PostgreSQL

查看:92
本文介绍了PostgreSQL中SQL Server的sysobject的替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将数据库从SQL Server移植到PostgreSQL。 PostgreSQL中的 sysobjects 是否有其他替代方法?如果是这样,那么它是什么以及如何使用?

I am porting a database from SQL Server to PostgreSQL. Is there any alternative to sysobjects in PostgreSQL? If so, then what is it and how can be it used?

我的观点:

create view int_objects_v as 
  select
     io.*, soae."REQ_TYPE_NAME", soae."REQ_TABLE_NAME", 
     stc1."CODE_DESC" int_type_name, stc2."CODE_DESC" operation_type_name, 
     s."NAME" target_obj_name 
  from 
     int_objects io  
  left join 
     req_request_types_v soae on soae."ID" = io."SOURCE_OBJ_ID"  
  left join 
     std_type_codes_v stc1 on (stc1."CODE" = io."INT_TYPE" 
                               and stc1."TYPE" = 'intr_type') 
  left join
     std_type_codes_v stc2 on (stc2."CODE" = io."OPERATION_TYPE" 
                               and stc2."TYPE" = 'opr_type') 
  left join 
     sysobjects s on (s."ID" = io."TARGET_OBJ_ID") 
  where 
     io."ACTIVE_FLAG" = '1';


推荐答案

PostgreSQL 支持SQL标准的 information_schema

PostgreSQL supports the SQL-standard information_schema.

MSSQL也是如此,但它还支持 sysobjects ,后者与 information_schema

So does MSSQL, but it also supports sysobjects which is older equivalent for information_schema.

如果您找到一种使用 information_schema 项重写查询的方法,那么您全部设置。

If you find a way to rewrite your query using information_schema terms, then you're all set.

也请在这里查看 INFORMATION_SCHEMA与sysobjects

这篇关于PostgreSQL中SQL Server的sysobject的替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆