Обсуждение: pgAdmin III commit: Beautify the query shown in the SQL pane for the fu

Поиск
Список
Период
Сортировка

pgAdmin III commit: Beautify the query shown in the SQL pane for the fu

От
Ashesh Vashi
Дата:
Beautify the query shown in the SQL pane for the functions having multiple
arguments.

Reviewed by Sanket Mehta and small modification done by Ashesh Vashi.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=ea803ad68290bb506fd2148ee8ea8f4176e34197
Author: J.F. Oster <jinfroster@mail.ru>

Modified Files
--------------
CHANGELOG                           |    3 +++
pgadmin/include/schema/pgFunction.h |    2 +-
pgadmin/schema/pgFunction.cpp       |   12 +++++++++---
3 files changed, 13 insertions(+), 4 deletions(-)


Re: pgAdmin III commit: Beautify the query shown in the SQL pane for the fu

От
"J.F. Oster"
Дата:
Hello Ashesh,

Right, bringing related logic close together is much better. But there
is a small difference in your version. Per discussion held on
pgadmin-support,

>> ...
>> vertical formatting shouldn't be applied where
>> number of parameters is less than two.

DP> Right.

So we expect:

CREATE OR REPLACE FUNCTION simple_function(param1 integer)
  RETURNS integer AS
$BODY$
select 1;
$BODY$
  LANGUAGE sql ...

but get:

CREATE OR REPLACE FUNCTION simple_function(
    param1 integer)
  RETURNS integer AS ...

I suggest changing line 518 from:
                else if (multiline)
to
                else if (multiline && argTypesArray.Count() > 1)


Thanks.


Tuesday, October 28, 2014, 2:35:50 PM, you wrote:

AV> Beautify the query shown in the SQL pane for the functions having multiple
AV> arguments.

AV> Reviewed by Sanket Mehta and small modification done by Ashesh Vashi.

AV> Branch
AV> ------
AV> master

AV> Details
AV> -------
AV> http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=ea803ad68290bb506fd2148ee8ea8f4176e34197
AV> Author: J.F. Oster <jinfroster@mail.ru>

AV> Modified Files
AV> --------------
AV> CHANGELOG                           |    3 +++
AV> pgadmin/include/schema/pgFunction.h |    2 +-
AV> pgadmin/schema/pgFunction.cpp       |   12 +++++++++---
AV> 3 files changed, 13 insertions(+), 4 deletions(-)

--
Best regards,
 J.F.



Re: pgAdmin III commit: Beautify the query shown in the SQL pane for the fu

От
Ashesh Vashi
Дата:
On Tue, Oct 28, 2014 at 9:58 PM, J.F. Oster <jinfroster@mail.ru> wrote:
Hello Ashesh,

Right, bringing related logic close together is much better. But there
is a small difference in your version. Per discussion held on
pgadmin-support,

>> ...
>> vertical formatting shouldn't be applied where
>> number of parameters is less than two.

DP> Right.

So we expect:

CREATE OR REPLACE FUNCTION simple_function(param1 integer)
  RETURNS integer AS
$BODY$
select 1;
$BODY$
  LANGUAGE sql ...

but get:

CREATE OR REPLACE FUNCTION simple_function(
    param1 integer)
  RETURNS integer AS ...

I suggest changing line 518 from:
                else if (multiline)
to
                else if (multiline && argTypesArray.Count() > 1)
Agree.

But - We're still missing one more scenario.
If the parameters (except first) are part of the record (TABLE) type, it will result into the same output as you shown.

I will commit one more revision soon.
Please test that.

Thanks for pointing that out.
-- Ashesh

Thanks.


Tuesday, October 28, 2014, 2:35:50 PM, you wrote:

AV> Beautify the query shown in the SQL pane for the functions having multiple
AV> arguments.

AV> Reviewed by Sanket Mehta and small modification done by Ashesh Vashi.

AV> Branch
AV> ------
AV> master

AV> Details
AV> -------
AV> http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=ea803ad68290bb506fd2148ee8ea8f4176e34197
AV> Author: J.F. Oster <jinfroster@mail.ru>

AV> Modified Files
AV> --------------
AV> CHANGELOG                           |    3 +++
AV> pgadmin/include/schema/pgFunction.h |    2 +-
AV> pgadmin/schema/pgFunction.cpp       |   12 +++++++++---
AV> 3 files changed, 13 insertions(+), 4 deletions(-)

--
Best regards,
 J.F.