Re: [pgAdmin4][Patch]: Functions/Procedures Module

Поиск
Список
Период
Сортировка
От Dave Page
Тема Re: [pgAdmin4][Patch]: Functions/Procedures Module
Дата
Msg-id CA+OCxowz38ek4d-km9+_pMPqbfHasvx24J5neLmsno0327ftTA@mail.gmail.com
обсуждение исходный текст
Ответ на [pgAdmin4][Patch]: Functions/Procedures Module  (Khushboo Vashi <khushboo.vashi@enterprisedb.com>)
Ответы Re: [pgAdmin4][Patch]: Functions/Procedures Module  (Khushboo Vashi <khushboo.vashi@enterprisedb.com>)
Список pgadmin-hackers
Hi

On Fri, Mar 11, 2016 at 9:34 AM, Khushboo Vashi
<khushboo.vashi@enterprisedb.com> wrote:
> Hi,
>
> Please find attached patch for the Functions/Procedures Module.
>
> To test this patch, "Unique collection Control and Variable Control Fixes"
> Patch submitted by me needs to be applied first.

Hi,

This is looking pretty good. I did a little bit of cleanup of the SQL
formatting, however I think a little more is needed;

- When creating a function, we might get the following:

=====
CREATE FUNCTION pem.whee(INOUT foo bigint DEFAULT 123) RETURNS bigint AS
$BODY$SELECT $1;$BODY$
LANGUAGE 'sql'  NOT LEAKPROOF

SET backslash_quote='on';


ALTER FUNCTION pem.whee(INOUT foo bigint )
    OWNER TO postgres;

GRANT ALL ON FUNCTION pem.whee(INOUT foo bigint ) TO pem_user;


COMMENT ON FUNCTION pem.whee(INOUT foo bigint )
    IS 'whee func';
=====

  - Remove the spaces after the argument lists, before the )
  - Remove the double blank lines
  - The opening $BODY$ should be indented
  - LANGUAGE should be indented
  - The are two spaces between 'sql' and NOT.

- Reverse engineered SQL may look like:

=====
-- FUNCTION: pem.whee(INOUT foo bigint)

-- DROP FUNCTION pem.whee(INOUT foo bigint);

CREATE OR REPLACE FUNCTION pem.whee(INOUT foo bigint DEFAULT 123)
 RETURNS bigint
 LANGUAGE sql
 SET backslash_quote TO 'on'
AS $function$SELECT $1;$function$
=====

  - We should be consistent with our heredoc markers ($BODY$ vs. $function$)
  - There's a 1 space indent
  - This formatting (bar the issues above) is much nicer that the
CREATE formatting.

I haven't found anything else of note yet, that I haven't fixed in
passing (though I have yet to test with PPAS). Updated patch attached.

Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Вложения

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

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: PATCH: Added Node Type & Catalog objects [pgAdmin4]
Следующее
От: Dave Page
Дата:
Сообщение: pgAdmin 4 commit: Default owner for new event triggers.