I am currently looking into Postgres as a possible alternative to SAP SQL Anywhere. I have successfully ported our development db (700 tables) into Postgres and am now attempting to create some equivalent views in the Postgres DB.
The following :
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
generates the following error :
ERROR: column a.oid does not exist
LINE 6: "SYS_Authorisation" AS a ON a.OID = ab...