Re: syntax error on Function return setoff

From: Andreas Kretschmer <andreas(at)a-kretschmer(dot)de>
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: syntax error on Function return setoff
Date: 2018-01-27 10:35:05
Message-ID: 45936da3-9ec0-f78c-f6bf-4d812e63c91c@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Am 26.01.2018 um 20:01 schrieb Garry Chen:
> Here is the short/simple function in postgresql 9.6.
>
> CREATE OR REPLACE FUNCTION public.sec_select_labor_data(

works for me, in 9.6 and 10. first i create a new table (and impliciet
the typ acct_nbr_lst)

test=# create table acct_nbr_lst (i int);
CREATE TABLE
test=*# CREATE OR REPLACE FUNCTION public.sec_select_labor_data(
test(#  )
test-#     RETURNS SETOF acct_nbr_lst
test-#     LANGUAGE 'plpgsql'
test-#
test-# AS $BODY$
test$# Declare
test$#      v_cnt        numeric;
test$#      sec_role     varchar(20);
test$#      v_netid      varchar(30);
test$# begin
test$#
test$#     RETURN QUERY Select acct_nbr from kdw_acct_security where
lower(netid) = CURRENT_USER;
test$#
test$# end;
test$#
test$# $BODY$;
CREATE FUNCTION
test=*#

works in 9.6 and 10.

Regards, Andreas

--
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David Rowley 2018-01-27 21:09:15 Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?
Previous Message Garry Chen 2018-01-26 19:01:41 Re: syntax error on Function return setoff