Обсуждение: New line for stored procedure parameters?

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

New line for stored procedure parameters?

От
inspector morse
Дата:
I have a stored procedure with several input/output parameters (about 50 of them). Everytime I go to edit the stored procedure in pgAdmin3, it prints all of the parameters in the same line...even if I last saved it with new lines. This makes it really difficult to see the parameter list as I have to scroll horizontally.

Is there a setting I can set in pgAdmin3 so it keeps my formatting...or at least prints each parameter in a new line instead of printing all of them horizontally?

Re: New line for stored procedure parameters?

От
David G Johnston
Дата:
inspector morse wrote
> I have a stored procedure with several input/output parameters (about 50
> of
> them). Everytime I go to edit the stored procedure in pgAdmin3, it prints
> all of the parameters in the same line...even if I last saved it with new
> lines. This makes it really difficult to see the parameter list as I have
> to scroll horizontally.
> 
> Is there a setting I can set in pgAdmin3 so it keeps my formatting...or at
> least prints each parameter in a new line instead of printing all of them
> horizontally?

There is no way for it to know what you did last time - while the body of
your function is stored as-is the various parts of the CREATE FUNCTION
statement are parsed and stored into the database catalogs.  pgAdmin then
queries those catalogs and recreates - in a canonical form - the command.

It would be possible for pgAdmin to toggle between "all on one line" and
"one line per parameter" but I am unsure if that is something it can
currently do.

While you provide no context I would recommend that you consider avoiding
OUT parameters and instead move them into the "RETURNS" clause.  Furthermore
I would probably define a "CREATE TYPE" and use that in the function
declaration.  If you have more than maybe 5-10 IN parameters I'd probably
convert those into a TYPE as well.  If you are working with table data each
table implicitly is has a type defined for it that you can reference as
well.

David J.





--
View this message in context:
http://postgresql.1045698.n5.nabble.com/New-line-for-stored-procedure-parameters-tp5814257p5814259.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.



Re: New line for stored procedure parameters?

От
Guillaume Lelarge
Дата:
2014-08-08 23:19 GMT+02:00 David G Johnston <david.g.johnston@gmail.com>:
inspector morse wrote
> I have a stored procedure with several input/output parameters (about 50
> of
> them). Everytime I go to edit the stored procedure in pgAdmin3, it prints
> all of the parameters in the same line...even if I last saved it with new
> lines. This makes it really difficult to see the parameter list as I have
> to scroll horizontally.
>
> Is there a setting I can set in pgAdmin3 so it keeps my formatting...or at
> least prints each parameter in a new line instead of printing all of them
> horizontally?

There is no way for it to know what you did last time - while the body of
your function is stored as-is the various parts of the CREATE FUNCTION
statement are parsed and stored into the database catalogs.  pgAdmin then
queries those catalogs and recreates - in a canonical form - the command.

It would be possible for pgAdmin to toggle between "all on one line" and
"one line per parameter" but I am unsure if that is something it can
currently do.


It cannot.  And I'm not sure this is something we'd like to add.


--