我目前正在研究 Postgres 作为 SAP SQL Anywhere 的可能替代方案。我已经成功地将我们的开发数据库(700 个表)移植到 Postgres 中,现在正尝试在 Postgres 数据库中创建一些等效的视图。
以下 :
CREATE VIEW "SYS_Authorisation_BO_Access_View"
AS
SELECT ROW_NUMBER() OVER (ORDER BY t1.OID) AS OID, t1.OID as BusinessObjectTypeID, t1.TypeName, t1.AccessType, t1.GroupID, a.Authorised, t1.defaultboauthorisation, COALESCE (a.Authorised, t1.defaultboauthorisation)
AS FinalAuthorisation
FROM "SYS_Authorisation_BO_Access" AS ab INNER JOIN
"SYS_Authorisation" AS a ON a.OID = ab.OID RIGHT OUTER JOIN
(SELECT o.OID, o.TypeName, at.AccessType, g.OID as GroupID,
CASE at.accesstype WHEN 'C' THEN g.defaultbocreateauthorisation WHEN 'M' THEN g.defaultbomodifyauthorisation WHEN 'D' THEN g.defaultbodeleteauthorisation
END AS defaultboauthorisation
FROM XPObjectType AS o CROSS JOIN
(SELECT 'C' AS AccessType
UNION
SELECT 'D' AS AccessType
UNION
SELECT 'M' AS AccessType) AS at CROSS JOIN
SYS_Group AS g) AS t1 ON ab.BusinessObjectTypeID = t1.OID AND ab.AccessType = t1.AccessType AND a.GroupID = t1.GroupID
生成以下错误:
ERROR: column a.oid does not exist
LINE 6: "SYS_Authorisation" AS a ON a.OID = ab...