Re: Using Array in Function

From: Günce Kaya <guncekaya14(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Using Array in Function
Date: 2017-10-09 20:37:05
Message-ID: CAAV2-mVywoogJLb9yzZzedL0LFv1Wp7d-gq18me0TnJcvBJktw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi David,

Thank you for quick response. Your advice solved my problem :)

Regards,
Gunce

On Mon, Oct 9, 2017 at 11:12 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Mon, Oct 9, 2017 at 12:40 PM, Günce Kaya <guncekaya14(at)gmail(dot)com> wrote:
>
>> I came across something strange about function. I have a function that
>> has an input parameter is an array like integer[] and return json value.
>> This input parameter is used in where clause.
>>
>> When I call function I'm using input parameter like '{int1,int2,int3}'
>> then return only result for first one int1. If I only execute sql script
>> that is in function with same parameter in where clause, sql script return
>> 3 rows that we need.
>>
>> It seems so weird. Both of results should be same for function and sql
>> script of function.
>>
>>
> ​A function will only return more than one row if it is defined as either:
>
> RETURNS TABLE
> or
> RETURNS SETOF <type>
>
> A script will always return all available rows.
>
> David J.
>
>

--
Gunce Kaya

Linkedin <https://tr.linkedin.com/in/guncekaya> - Twitter
<https://twitter.com/gguncesi> - Blog
<http://www.guncekaya.blogspot.com.tr/>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message ROS Didier 2017-10-10 11:38:59 Need Help on SQL Query
Previous Message David G. Johnston 2017-10-09 20:12:21 Re: Using Array in Function