Re: [SQL] Using Array in Function

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [SQL] Using Array in Function
Дата
Msg-id CAKFQuwb8dX8LhzsaTQL0OmYtm+oEz1hBN9QhE4STsHHSKSMT9g@mail.gmail.com
обсуждение исходный текст
Ответ на [SQL] Using Array in Function  (Günce Kaya <guncekaya14@gmail.com>)
Ответы Re: [SQL] Using Array in Function  (Günce Kaya <guncekaya14@gmail.com>)
Список pgsql-sql
On Mon, Oct 9, 2017 at 12:40 PM, Günce Kaya <guncekaya14@gmail.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.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Günce Kaya
Дата:
Сообщение: [SQL] Using Array in Function
Следующее
От: Günce Kaya
Дата:
Сообщение: Re: [SQL] Using Array in Function