agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Yeb Havinga <[email protected]>
To: Tom Lane <[email protected]>
Cc: Heikki Linnakangas <[email protected]>
Cc: Kevin Grittner <[email protected]>
Cc: [email protected]
Subject: Re: [REVIEW] Patch for cursor calling with named parameters
Date: Wed, 14 Dec 2011 11:31:55 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

On 2011-12-13 18:34, Tom Lane wrote:
> Heikki Linnakangas<[email protected]>  writes:
>> Attached is a patch with those changes. I also I removed a few of the
>> syntax error regression tests, that seemed excessive, plus some general
>> naming and comment fiddling. I'll apply this tomorrow, if it still looks
>> good to me after sleeping on it.
> However, I'm still concerned about whether this approach gives
> reasonable error messages in cases where the error would be
> detected during parse analysis of the rearranged statement.
> The regression test examples don't cover such cases, and I'm
> too busy right now to apply the patch and check for myself.
> What happens for example if a named parameter's value contains
> a misspelled variable reference, or a type conflict?

I tested this and seems to be ok:

regression=# select namedparmcursor_test1(20000, 20000) as "Should be 
false",
        namedparmcursor_test1(20, 20) as "Should be true";
ERROR:  column "yy" does not exist
LINE 1: SELECT x AS param1, yy AS param12;

regression=# select namedparmcursor_test1(20000, 20000) as "Should be 
false",
        namedparmcursor_test1(20, 20) as "Should be true";
ERROR:  invalid input syntax for integer: "2011-11-29 19:26:10.029084"
CONTEXT:  PL/pgSQL function "namedparmcursor_test1" line 8 at OPEN

regards,
Yeb Havinga

last error was created with

create or replace function namedparmcursor_test1(int, int) returns 
boolean as $$
declare
     c1 cursor (param1 int, param12 int) for select * from rc_test where 
a > param1 and b > param12;
     y int := 10;
     x timestamp := now();
     nonsense record;
begin
     open c1(param12 := $1, param1 := x);
end
$$ language plpgsql;




view thread (38+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [REVIEW] Patch for cursor calling with named parameters
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox