Opening a plpgsql cursor parameter by name

From: Yeb Havinga <yebhavinga(at)gmail(dot)com>
To: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: "w(dot)p(dot)dijkstra(at)mgrid(dot)net" <w(dot)p(dot)dijkstra(at)mgrid(dot)net>
Subject: Opening a plpgsql cursor parameter by name
Date: 2010-09-22 15:03:40
Message-ID: 4C9A1ACC.3080409@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello list,

We intend to implement $subject, so instead of

mycursor CURSOR (myparm text) IS SELECT myparm;
OPEN mycursor('A');

it would be possible to do

OPEN mycursor(myparm := 'A');

The idea is to

* in pl_exec.exec_stmt_forc, detect if a positional parameter or named
parameter is used.
* if named, use plpgsql_ns_lookup to find the cursur arguments position
in the plpgsql name space.
* normal processing for the found position from here.

Mixing named and positional could probably be made to work as well.

Does this approach sound reasonable?

regards,
Yeb Havinga & Willem Dijkstra

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-09-22 15:07:40 Re: Git cvsserver serious issue
Previous Message Magnus Hagander 2010-09-22 14:57:24 Re: snapshot generation broken