I have a function that returns a resultset so defined
CREATE TABLE tbl_obj_clients (
id uuid NOT NULL,
"type" schappnme_300.enm_obj_clients_types NOT NULL,
status schappnme_300.enm_obj_clients_statuses NOT NULL,
info jsonb NOT NULL,
CONSTRAINT pk_tbl_obj_clients PRIMARY KEY (id)
);
But when I call the function from code seems that the return type is converted into RECORD type not the well known tbl_obj_clients.
CREATE OR REPLACE FUNCTION schappnme_300.fn_create_clients(in_type text DEFAULT 'ordinary'::text, in_status text DEFAULT 'active'::text, in_info json DEFAULT NULL::json, in_debug boolean DEFAULT false)
RETURNS SETOF schappnme_300.tbl_obj_clients
LANGUAGE plpgsql
AS $function$
...
In fact when I call the specific function
v_client tbl_obj_clients := NULL;
FOR v_client IN SELECT fn_create_clients('system', 'active', v_com_json, in_debug)
LOOP
RAISE NOTICE '%',v_client;
END LOOP;
I obtain the specific output
("(d8526882-f656-4873-9b49-de972202ca66,system,active,""{""""data"""": [{""""type"""": """"string"""", """"label"""": """"Name"""", """"value"""": """"NotifyMe"""", """"description"""": """"obj_client_name"""", """"placeholder"""": """"[*client_name*]"""", """"sequenceorder"""": 10}, {""""type"""": """"string"""", """"label"""": """"Description"""", """"value"""": """"NotifyMe Administration Account"""", """"description"""": """"obj_client_description"""", """"placeholder"""": """"[*client_description*]"""", """"sequenceorder"""": 20}, {""""type"""": """"datetime"""", """"label"""": """"Created On"""", """"value"""": """"2019-07-29 17:30:00"""", """"description"""": """"obj_client_createdon"""", """"placeholder"""": """"[*client_created_on*]"""", """"sequenceorder"""": 30}, {""""type"""": """"datetime"""", """"label"""": """"Last Modified On"""", """"value"""": """"2019-07-29 17:30:00"""", """"description"""": """"obj_client_lastmodifiedon"""", """"placeholder"""": """"[*client_last_modified_on*]"""", """"sequenceorder"""": 40}, {""""type"""": """"numeric"""", """"label"""": """"Last Update"""", """"value"""": 0, """"description"""": """"obj_client_lastupdate"""", """"placeholder"""": """"[*client_last_update*]"""", """"sequenceorder"""": 50}], """"meta"""": {""""class"""": """"obj_client"""", """"dsname"""": """"tbl_obj_client"""", """"version"""": """"1.0.0""""}}"")")
In fact I can't access specific fields from the record, this instruction throws me an error:
RAISE NOTICE '%',v_client.id;
v_client.id 22P02 syntax not vald for type uuid.