Re: syntax error on Function return setoff

Поиск
Список
Период
Сортировка
От Garry Chen
Тема Re: syntax error on Function return setoff
Дата
Msg-id 56BF7A97-2301-4AC5-A651-1A32B25157B0@cornell.edu
обсуждение исходный текст
Ответ на Re: syntax error on Function return setoff  (Andreas Kretschmer <andreas@a-kretschmer.de>)
Ответы Re: syntax error on Function return setoff
Список pgsql-novice
Hi Andreas,
    Thank you very much for your reply.  Very strange, in 9.6 the function created/compiled successful  without the
tablecalled "acct_nbr_lst".  But in release 10 this table "acct_nbr_lst" must exist in order to create/compiled this
function.  In RDBMS function/procedure coding principal, I don’t know which one is the correct way.  Is there any
Postgresqldocuments that states/mentation the prerequisite about the SETOF?   Once again thank you very much for your
help.

Garry

On 1/27/18, 5:35 AM, "Andreas Kretschmer" <andreas@a-kretschmer.de> wrote:

    
    
    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
    
    
    


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

Предыдущее
От: Dav Clark
Дата:
Сообщение: Using the pgadmin4 packages
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: syntax error on Function return setoff