1

I have created a procedure in postgresql as below.

CREATE OR REPLACE FUNCTION public.functiontest2(
    IN data numeric,
    OUT result numeric,
   OUT result1 numeric)
RETURNS record AS
$BODY$
  DECLARE
    declare SEQVAL decimal := 10;

    BEGIN   
      result=SEQVAL;
      result1=data;
    END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;

Now I have executed this procedure from node pg as

client.query('select functionTest2(10)', input, function(err, result){});

Previously, When I executed above code , It had given me result in following format.

{
"command":"SELECT",
"rowCount":1,
"oid":null,
"rows":[{"result":"10"},{"result1":"10"}],
"fields":[{"name":"result","tableID":0,"columnID":0,"dataTypeID":1700,"dataTypeSize":-1,"dataTypeModifier":-1,"format":"text"}],
"_parsers":[null],
"rowAsArray":false
}

But now I have uninstalled node pg module and installed node pg module again. It is giving me result in following format

{
 "command":"SELECT",
 "rowCount":1,
 "oid":null,
 "rows":[{"functiontest2":"(10,10)"}],
 "fields":          [{"name":"functiontest2","tableID":0,"columnID":0,"dataTypeID":2249,"dataTypeSize":-1,"dataTypeModifier":-1,"format":"text"}],
 "_parsers":[null],
 "rowAsArray":false}

Thus, The difference is instead of returning name value pair for records, It returns function name and value array. I have tried installing different version of node pg module but the problem persists.

Thanks in advance.

1
  • ok .. guys I have found problem.. Actually I need to use query like select * from function2(10); It had solved problem Commented May 2, 2016 at 5:33

1 Answer 1

2

ok .. guys I have found problem.. Actually I need to use query like select * from function2(10); It had solved problem

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.