I’m pulling my hair out here. I have the following sample SP – keep in mind I have already declared rec as RECORD;
FOR rec IN
SELECT
"AclObjects"."ObjectName",
"AclRoles"."RoleId"
FROM
"AclObjects",
"AclRoles",
"AclGrantRole"
WHERE
"AclObjects"."ObjectRef" = "AclGrantRole"."ObjectRef"
AND "AclRoles"."RoleId" = "AclGrantRole"."RoleId"
AND "AclObjects"."ObjectClass" = "inObjectClass"
AND now() BETWEEN "AclGrantRole"."EffectiveFrom"
AND "AclGrantRole"."EffectiveTo"
LOOP
"outStatusCode" := 0;
"outObjectName" := rec."AclRoles"."ObjectName";
"outObjectName" := rec."AclRoles"."RoleId";
"outStatusMsg" := NULL;
return next;
END LOOP;
Notice I’m trying to assign other camel case variables to the record variables. I’ve tried searching for this but nothing comes up.
Essentially, it’s very likely I could have two tables with the same column name that I want to return fully referenced Table1.ColumnName, and Table2.ColumnName
So:
1) I’m unsure of how RECORD handles fully referenced SELECT values
2) Is it even possible to return them when they are camel case
Any help would be greatly appreciated.
You can return case sensitive identifier. But second part – rec.”AclRoles”.”ObjectName” is nonsense – should be rec.”ObjectName”.
RETURN QUERY or just sql function instead plpgsql is better solution