pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: patch for passing the cts
Date: Wed, 15 Jun 2005 06:45:04 -0400
Message-ID: <379C1838-A611-4DB0-92D5-EF78C2FCFB1E@fastcrypt.com> (raw)
In-Reply-To: <42AFB291.6070405@opencloud.com>
References: <2BC23AE7-6381-41BA-AE89-CC81D1C932A7@fastcrypt.com>
	<42AF6682.6000405@opencloud.com>
	<EB3B2C5E-9B58-44F8-8FD8-A23407F9EEA9@fastcrypt.com>
	<42AFB291.6070405@opencloud.com>

Oliver,

Good observation. However aren't we back to the parsing before  
register, set ?

What about making the output of the current query parser a little  
more flexible, and putting some of the intelligence in the executor.

More specifically, the parser currently breaks things up into  
fragments which are very easily re-assembled by the executor. Instead  
use the strategy below


Dave
On 15-Jun-05, at 12:46 AM, Oliver Jowett wrote:

> Dave Cramer wrote:
>
>
>> Do you have any suggestions ?
>>
>
> Also, the parser for {call} is going to have to get a lot smarter. A
> first cut at what it needs to do..
>
> Extract this information from the query:
>
> - Name of the called function
> - Number of ? parameter placeholders
> - Text of each function argument
> - Mapping from parameter index to function argument (many-to-one)
> - Eligibility of each parameter for being an OUT parameter (this  
> can be
> determined from the text the parameter maps to -- if it's a bare "?"
> then it's eligible)
>
> On execute, you reassemble a query from the IN function arguments  
> text only.
>
> e.g. for the query "{call f(?+?,?)}" you'll get:
>
>  function = "f"
>  3 parameters
>  2 function arguments:
>    argument 1 = "?+?"
>    argument 2 = "?"
>  parameter 1 maps to function arg 1 and can't be OUT
>  parameter 2 maps to function arg 1 and can't be OUT
>  parameter 3 maps to function arg 2 and can be OUT
>
> If you set all 3 parameters as IN parameters, it assembles a SELECT
> including all function arguments:
>
>   "select * from f(?+?,?) as result"
>
> and gives it to the query executor which executes:
>
>   "select * from f($1+$2,$3) as result"
>
> If you set parameter 3 to OUT, it excludes the corresponding function
> argument (argument 2) when assembling the SELECT:
>
>   "select * from f(?+?) as result"
>
> resulting in the actual query:
>
>   "select * from f($1+$2) as result"
>
>
> Hmm.. perhaps you could get a similar effect by doing the normal query
> fragmentation then stripping a comma (only) from one of the adjacent
> fragments to an OUT parameter, then merging the two adjacent fragments
> as you remove the parameter; but that seem pretty hairy..
Yeah, as shown, it gets ugly

>
> -O
>
>




view thread (7+ messages)  latest in thread

Message-ID: <379C1838-A611-4DB0-92D5-EF78C2FCFB1E@fastcrypt.com>
Permalink:  ../379C1838-A611-4DB0-92D5-EF78C2FCFB1E@fastcrypt.com/
Also on:    postgresql.org/message-id/379C1838-A611-4DB0-92D5-EF78C2FCFB1E@fastcrypt.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, oliver@opencloud.com
  Subject: Re: patch for passing the cts
  In-Reply-To: <379C1838-A611-4DB0-92D5-EF78C2FCFB1E@fastcrypt.com>
  References: <2BC23AE7-6381-41BA-AE89-CC81D1C932A7@fastcrypt.com> <42AF6682.6000405@opencloud.com> <EB3B2C5E-9B58-44F8-8FD8-A23407F9EEA9@fastcrypt.com> <42AFB291.6070405@opencloud.com> <379C1838-A611-4DB0-92D5-EF78C2FCFB1E@fastcrypt.com>

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

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