Re: [SQL] 16 parameter limit - Mailing list pgsql-patches

From Josh Berkus
Subject Re: [SQL] 16 parameter limit
Date
Msg-id web-1374310@davinci.ethosmedia.com
Whole thread Raw
In response to Re: [SQL] 16 parameter limit  (John Proctor <jproctor@prium.net>)
Responses Re: [SQL] 16 parameter limit  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Folks,

> 1) More than 16 parameters.   This can be parameter configurable if
> necessary, but up to 128 would cover 99.9%.
>
> 2) Better exception handling.  The procedure should be able to trap
> any data
> related exception and decide what to do.   No function should ever
> abort.  It should raise a trappable exception and let me decide what
> to do.
>
> 3) Allow transactions inside of functions.   Mostly for incremental
> commits.
> Each transaction shoud be implicitely started after any CrUD
> statement and
> continue until a commit or rollback.
>
> 4) Allow autonomous transactions.  This is related to number 2.  In
> Oracle, I
> can track every single exception and log it in a central table with
> details,
> even if I rollback the current transaction or savepoint.   This is a
> must for
> tracking every single database error in an application at the exact
> point of
> failure.
>
> 5) Find a way to get rid of the requirement to quote the entire proc.
>   This
> is very clumsy.   The PL/pgSQL interpreter should be able to do the
> quoting
> and escape what it needs.
>
> 6) Allow function parameters to be specified by name and type during
> the definition. Even aliasing is cumbersome and error prone on large
> procs, especially during development when changes are frequent.
>
> 7) Allow function parameters to be passed by name, not just
> positional.  i.e.
> get_employee_salary(emp_id => 12345, tax_year => 2001).
>
> 8) Add packages.  This is a great way to group related functions,
> create
> reusable objects, like cursors, etc.
>
> 9) Allow anonymous PL/pgSQL blocks.   It should not be required to
> create a
> function for every PL/pgSQL block.   Often, I just want to do
> something quick
> and dirty or write complex blocks that I don't even want saved in the
>
> database.  I can just keep then in a file and execute when necessary.

Also:

10) Allow declaration of all PostgreSQL data types, including custom
data types and domains, inside functions.  Especially important are
Arrays, which are supported as parameters but not as declarations.

11) PL/pgSQL has functionality 100% analagous to cursors, with a
different syntax.  While the PL/pgSQL record loop is easier to use, the
lack of support for standard cursor syntax mars the poratbility of
Oracle procedures to Postgres and vice-versa.

12) The biggie:  Allowing the easy return of query results from a
procedure.  This is currently supported through a rather difficult
workaround involving either the ROWTYPE datatype or a return Cursor.
 Both approaches require the use of a procedural code loop on the
interface side to read the data being returned ... much clumsier than
just dumping the data ala PL/SQL or T-SQL.  If implemented, this rowset
return would the the difference between a CREATE FUNCTION and a CREATE
PROCEDURE statement.

13) Allow the creation of multiple output parameters for PROCEDURES (as
opposed to FUNCTIONS) in the parameter declaration.

14) Procedures should have their own permissions, which supercede the
permissions on the tables being affected if the procedure is created by
the database owner, in the same way that Views can allow users to
Select data they would not be entitled to from the base tables.  In
other words, if I declare "GRANT SELECT ON fn_modify_assignment TO
phpaccess", the user phpaccess should be able to run
fn_modify_assignment even if that user has no permissions on the
assignment table itself.

-Josh Berkus

P.S. I haven't brought up these issues before because there is no way I
can contribute any significant resources to completing them.

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

pgsql-patches by date:

Previous
From: "Nicolas Bazin"
Date:
Subject: Re: [HACKERS] build of 7.2.1 on SCO Openserver and Unixware
Next
From: David Wheeler
Date:
Subject: Re: Mac OS X Startup Script