From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: RETURNS TABLE function returns nothingness |
Date: | 2016-09-02 17:27:04 |
Message-ID: | CAFj8pRDXo1EXJjBcsp-kbwg=xWycu_54Kq2dxa_ywKuNGRsVbg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2016-09-02 19:21 GMT+02:00 Alexander Farber <alexander(dot)farber(at)gmail(dot)com>:
> Good evening,
>
> please help me to figure out, why doesn't this simple test function return
> a row with 42, NULL values:
>
> CREATE OR REPLACE FUNCTION words_merge_users_2(
> IN in_users jsonb,
> IN in_ip inet
> ) RETURNS TABLE (
> out_uid integer,
> out_banned varchar
> ) AS
> $func$
> DECLARE
> _user jsonb;
> _uids integer[];
> _created timestamptz;
> _vip timestamptz;
> _grand timestamptz;
> _banned_until timestamptz;
> _banned_reason varchar;
> BEGIN
> out_uid := 42;
> END
> $func$ LANGUAGE plpgsql;
>
>
> Here I call it at PostgreSQL 9.5.4 prompt in MacOS:
>
> # select * from words_merge_users_2('[{"given":"Abcde","social":1,"auth":"
> 07f0254f5e55413dec7f32c8ef4ee5d3","stamp":1470237061,"female":0,"sid":"11111"}]
> '::jsonb, '1.1.1.1'::inet);
> out_uid | out_banned
> ---------+------------
> (0 rows)
>
>
> Thank you (I am probably missing something very obvious)
>
There is not RETURN NEXT statement - so output is zero rows.
Regards
Pavel
> Alex
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2016-09-02 17:32:46 | Re: What limits Postgres performance when the whole database lives in cache? |
Previous Message | Alexander Farber | 2016-09-02 17:21:15 | RETURNS TABLE function returns nothingness |