Skip site navigation (1) Skip section navigation (2)

Re: [SQL] 16 parameter limit

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: John Proctor <jproctor(at)prium(dot)net>,Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>
Cc: josh(at)agliodbs(dot)com, peter_e(at)gmx(dot)net, pgman(at)candle(dot)pha(dot)pa(dot)us,tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-patches(at)postgresql(dot)org
Subject: Re: [SQL] 16 parameter limit
Date: 2002-04-17 16:08:58
Message-ID: web-1374310@davinci.ethosmedia.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patchespgsql-sql
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(at)agliodbs(dot)com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2002-04-17 16:10:28
Subject: Re: Index Scans become Seq Scans after VACUUM ANALYSE
Previous:From: Tom LaneDate: 2002-04-17 15:46:28
Subject: Re: Index Scans become Seq Scans after VACUUM ANALYSE

pgsql-patches by date

Next:From: Magnus Naeslund(f)Date: 2002-04-17 23:48:30
Subject: Re: Win32 Error descriptions + config
Previous:From: Larry RosenmanDate: 2002-04-17 14:41:29
Subject: Re: [SQL] 16 parameter limit

pgsql-sql by date

Next:From: Josh BerkusDate: 2002-04-17 16:16:24
Subject: Re: Need some help with dates
Previous:From: Tom LaneDate: 2002-04-17 15:25:35
Subject: Re: How to reset sequences on pre-7.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group