Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Tom Lane
Alvaro Herrera writes: > Excerpts from Tom Lane's message of mar jul 10 10:56:50 -0400 2012: >> What's to solve? Presumably the WITH function name would take >> precedence over anything in the catalogs, the same as WITH query names >> take precedence over actual tables. > Hm, would the newly def

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Alvaro Herrera
Excerpts from Tom Lane's message of mar jul 10 10:56:50 -0400 2012: > Pavel Stehule writes: > > 2012/7/10 Dimitri Fontaine : > >> I'm not sure I can understand the difference between that and the use > >> case for which you want to implement DO blocks with parameters. > > > this is similar to te

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Tom Lane
Pavel Stehule writes: > 2012/7/10 Dimitri Fontaine : >> I'm not sure I can understand the difference between that and the use >> case for which you want to implement DO blocks with parameters. > this is similar to temporary functions - you need some temporary name > - it is insert to pg_proc, and

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Pavel Stehule
2012/7/10 Dimitri Fontaine : > Pavel Stehule writes: WITH FUNCTION foo(param list) returns rettype language foo AS ( definition here ) ; >>> >>> I like this idea. This gets rid of both the "how to pass parameters" >>> and the "how to return results" issues that exist

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Dimitri Fontaine
Pavel Stehule writes: >>> WITH FUNCTION foo(param list) returns rettype language foo AS ( >>> definition here >>> ) >>> ; >> >> I like this idea. This gets rid of both the "how to pass parameters" >> and the "how to return results" issues that exist with DO, as well as >> assorted imple

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Pavel Stehule
2012/7/10 Tom Lane : > Dimitri Fontaine writes: >> We could imagine several syntax to show up the idea, common keywords >> here include LAMBDA, FLET or LABELS, but I think that expanding WITH >> would be preferable for us. > >> WITH FUNCTION foo(param list) returns rettype language foo AS ( >>

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Tom Lane
Dimitri Fontaine writes: > We could imagine several syntax to show up the idea, common keywords > here include LAMBDA, FLET or LABELS, but I think that expanding WITH > would be preferable for us. > WITH FUNCTION foo(param list) returns rettype language foo AS ( > definition here > ) >

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Pavel Stehule
2012/7/10 Dimitri Fontaine : > Pavel Stehule writes: >> When I worked on parametrised DO statement, I had to solve following issue: > > DO currently is a utility command, not a query. Do you mean to change > that? > > Also, did you think about a lambda construct, which is basically > allowing func

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Dimitri Fontaine
Pavel Stehule writes: > When I worked on parametrised DO statement, I had to solve following issue: DO currently is a utility command, not a query. Do you mean to change that? Also, did you think about a lambda construct, which is basically allowing functions to be defined inline in a query? We

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-08 Thread Pavel Stehule
2012/7/8 Tom Lane : > Pavel Stehule writes: >> When I worked on parametrised DO statement, I had to solve following issue: > >> Syntax is: > >> DO (param list) $$ ... $$ LANGUAGE ... USING expr_list > >> What is correct way for evaluation of expr_list with specified target types? > > I'd argue tha

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-08 Thread Tom Lane
Pavel Stehule writes: > When I worked on parametrised DO statement, I had to solve following issue: > Syntax is: > DO (param list) $$ ... $$ LANGUAGE ... USING expr_list > What is correct way for evaluation of expr_list with specified target types? I'd argue that that's a pointlessly unwieldy

[HACKERS] expression evaluation with expected datatypes

2012-07-08 Thread Pavel Stehule
Hello When I worked on parametrised DO statement, I had to solve following issue: Syntax is: DO (param list) $$ ... $$ LANGUAGE ... USING expr_list What is correct way for evaluation of expr_list with specified target types? I used two techniques: 1) evaluation expressions - http://archives.p