From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Günce Kaya <guncekaya14(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:12:21 |
Message-ID: | CAKFQuwb8dX8LhzsaTQL0OmYtm+oEz1hBN9QhE4STsHHSKSMT9g@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Günce Kaya | 2017-10-09 20:37:05 | Re: Using Array in Function |
Previous Message | Günce Kaya | 2017-10-09 19:40:34 | Using Array in Function |